Browse Source

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

csx 4 years ago
parent
commit
7680f9f7c6

+ 0 - 5
.gitignore View File

@@ -1,5 +0,0 @@
1
-.svn
2
-.git
3
-XT.ext
4
-/*.exe
5
-/*.exe~

+ 3 - 2
controllers/dialysis_api_controller.go View File

@@ -4308,11 +4308,12 @@ func (c *DialysisApiController) GetDialysisOrder() {
4308 4308
 	//获取医嘱内容
4309 4309
 	doctor, err := service.FindDoctor(doctorAdvice.AdviceDoctor, adminUserInfo.CurrentAppId, adminUserInfo.CurrentOrgId)
4310 4310
 	DoctorName, err := service.FindDoctorName(doctorAdvice.AdviceDoctor, adminUserInfo.CurrentAppId, adminUserInfo.CurrentOrgId)
4311
-	//fmt.Print("err---------------------------------",err)
4311
+	fmt.Print("err-----------------------------------------------------------------", err)
4312 4312
 	DoctorAdvice, _ := service.FindDoctorAdviceOrderById(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4313 4313
 	doctorAdevieInfo, err := service.FindDoctorAdviceByInfo(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4314 4314
 	//获取上次的透后体重
4315
-	assessmentAfterDislysis, _ := service.MobileGetLastTimeAssessmentAfterDislysis(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4315
+	//	assessmentAfterDislysis, _ := service.MobileGetLastTimeAssessmentAfterDislysis(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4316
+	assessmentAfterDislysis, _ := service.MobileGetLast(adminUserInfo.CurrentOrgId, patientInfo.ID, xttime)
4316 4317
 	//获取透析次数
4317 4318
 	_, total, err := service.GetTotalDialysisCout(adminUserInfo.CurrentOrgId, patientInfo.ID)
4318 4319
 

+ 1 - 1
controllers/inspection_api_controller.go View File

@@ -432,7 +432,7 @@ func (c *InspectionApiController) GetPatientInspections() {
432 432
 
433 433
 	date := ""
434 434
 	if len(inspections) > 0 {
435
-		date = time.Unix(dateTime, 0).Format("2006-01-02")
435
+		date = time.Unix(dateTime, 0).Format("2006-01-02 15:04")
436 436
 	}
437 437
 
438 438
 	c.ServeSuccessJSON(map[string]interface{}{

+ 2 - 0
controllers/mobile_api_controllers/mobile_api_base_controller.go View File

@@ -23,6 +23,8 @@ func (this *MobileBaseAPIController) Prepare() {
23 23
 	// beego.Trace("============================================================")
24 24
 }
25 25
 
26
+//
27
+
26 28
 func (this *MobileBaseAPIController) GetMobileAdminUserInfo() *MobileAdminUserInfo {
27 29
 	userInfo := this.GetSession("mobile_admin_user_info")
28 30
 	if userInfo == nil {

+ 28 - 5
controllers/new_mobile_api_controllers/new_dialysis_api_controller.go View File

@@ -1772,14 +1772,24 @@ func (this *NewDialysisApiController) GetOrgName() {
1772 1772
 func (this *NewDialysisApiController) GetRoleName() {
1773 1773
 	id, _ := this.GetInt64("id")
1774 1774
 	fmt.Println("id", id)
1775
-	orgid := this.GetMobileAdminUserInfo().Org.Id
1775
+	orgid, _ := this.GetInt64("orgid")
1776 1776
 	fmt.Println("orgid", orgid)
1777
-	appid := this.GetMobileAdminUserInfo().App.Id
1778
-	fmt.Println("appid", appid)
1779
-	name, err := service.GetRoleName(id, orgid, appid)
1777
+	//跟剧机构ID获取APPID
1778
+	app, _ := service.GetAppId(orgid)
1779
+	name, err := service.GetRoleName(id, orgid, app.Id)
1780 1780
 	//获取管理员
1781 1781
 	admin, err := service.GetAdmin(id)
1782
-	positionName, err := service.GetPositionName(id, orgid, appid)
1782
+	positionName, err := service.GetPositionName(id, orgid, app.Id)
1783
+	role_ids := strings.Split(positionName.RoleIds, ",")
1784
+	var names = ""
1785
+	for _, item := range role_ids {
1786
+		id, _ := strconv.ParseInt(item, 10, 64)
1787
+		role, _ := service.GetRole(id)
1788
+		if len(role.RoleName) != 0 {
1789
+			names = role.RoleName + "," + names
1790
+		}
1791
+	}
1792
+	fmt.Println("role_ids--------------", role_ids)
1783 1793
 	if err != nil {
1784 1794
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
1785 1795
 		return
@@ -1788,6 +1798,7 @@ func (this *NewDialysisApiController) GetRoleName() {
1788 1798
 		"name":         name,
1789 1799
 		"positionName": positionName,
1790 1800
 		"admin":        admin,
1801
+		"names":        names,
1791 1802
 	})
1792 1803
 }
1793 1804
 
@@ -2382,3 +2393,15 @@ func (this *NewDialysisApiController) GetCurrentOrg() {
2382 2393
 		"signToken": signToken,
2383 2394
 	})
2384 2395
 }
2396
+
2397
+func (this *NewDialysisApiController) GetMyMobile() {
2398
+	id, _ := this.GetInt64("id")
2399
+	mobile, err := service.GetMyMobile(id)
2400
+	if err != nil {
2401
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeSystemError)
2402
+		return
2403
+	}
2404
+	this.ServeSuccessJSON(map[string]interface{}{
2405
+		"mobile": mobile,
2406
+	})
2407
+}

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

@@ -148,4 +148,5 @@ func NewMobileAPIControllersRegisterRouters() {
148 148
 	beego.Router("/m/api/patient/savenametwo", &NewDialysisApiController{}, "Get:SaveNameTwo")
149 149
 	beego.Router("/m/api/patient/getcurrentorg", &NewDialysisApiController{}, "Get:GetCurrentOrg")
150 150
 	beego.Router("/m/api/patient/getmyinformationfour", &NewDialysisApiController{}, "Get:GetMyInformationFour")
151
+	beego.Router("/m/api/org/getMyMobile", &NewDialysisApiController{}, "Get:GetMyMobile")
151 152
 }

+ 17 - 16
models/dialysis.go View File

@@ -804,22 +804,23 @@ func (GobalTemplate) TableName() string {
804 804
 }
805 805
 
806 806
 type SgjUserAdminRole struct {
807
-	ID          int64  `gorm:"column:id" json:"id" form:"id"`
808
-	AdminUserId int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
809
-	OrgId       int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
810
-	AppId       int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
811
-	RoleId      int64  `gorm:"column:role_id" json:"role_id" form:"role_id"`
812
-	UserName    string `gorm:"column:user_name" json:"user_name" form:"user_name"`
813
-	Avatar      string `gorm:"column:avatar" json:"avatar" form:"avatar"`
814
-	UserType    int64  `gorm:"column:user_type" json:"user_type" form:"user_type"`
815
-	UserTitle   int64  `gorm:"column:user_title" json:"user_title" form:"user_title"`
816
-	Intro       string `gorm:"column:intro" json:"intro" form:"intro"`
817
-	Status      int64  `gorm:"column:status" json:"status" form:"status"`
818
-	Ctime       int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
819
-	Mtime       int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
820
-	Message     string `gorm:"column:message" json:"message" form:"message"`
821
-	Sex         int64  `gorm:"column:sex" json:"sex" form:"sex"`
822
-	Birthday    int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
807
+	ID            int64  `gorm:"column:id" json:"id" form:"id"`
808
+	AdminUserId   int64  `gorm:"column:admin_user_id" json:"admin_user_id" form:"admin_user_id"`
809
+	OrgId         int64  `gorm:"column:org_id" json:"org_id" form:"org_id"`
810
+	AppId         int64  `gorm:"column:app_id" json:"app_id" form:"app_id"`
811
+	RoleId        int64  `gorm:"column:role_id" json:"role_id" form:"role_id"`
812
+	UserName      string `gorm:"column:user_name" json:"user_name" form:"user_name"`
813
+	Avatar        string `gorm:"column:avatar" json:"avatar" form:"avatar"`
814
+	UserType      int64  `gorm:"column:user_type" json:"user_type" form:"user_type"`
815
+	UserTitle     int64  `gorm:"column:user_title" json:"user_title" form:"user_title"`
816
+	Intro         string `gorm:"column:intro" json:"intro" form:"intro"`
817
+	Status        int64  `gorm:"column:status" json:"status" form:"status"`
818
+	Ctime         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
819
+	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
820
+	Message       string `gorm:"column:message" json:"message" form:"message"`
821
+	Sex           int64  `gorm:"column:sex" json:"sex" form:"sex"`
822
+	Birthday      int64  `gorm:"column:birthday" json:"birthday" form:"birthday"`
823
+	UserTitleName string `gorm:"column:user_title_name" json:"user_title_name" form:"user_title_name"`
823 824
 }
824 825
 
825 826
 func (SgjUserAdminRole) TableName() string {

+ 7 - 1
service/inspection_service.go View File

@@ -8,7 +8,13 @@ import (
8 8
 )
9 9
 
10 10
 func GetInspectionReference(orgId int64) (reference []*models.InspectionReference, err error) {
11
-	err = readDb.Model(&models.InspectionReference{}).Where("(org_id=0 OR org_id=?) and status=1", orgId).Order("project_id").Find(&reference).Error
11
+	var count int
12
+	err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1", orgId).Count(&count).Error
13
+	if count > 0 {
14
+		err = readDb.Model(&models.InspectionReference{}).Where("org_id=? and status=1", orgId).Order("project_id").Find(&reference).Error
15
+	} else {
16
+		err = readDb.Model(&models.InspectionReference{}).Where("org_id=0 and status=1").Order("project_id").Find(&reference).Error
17
+	}
12 18
 	return
13 19
 }
14 20
 

+ 6 - 0
service/manage_service.go View File

@@ -416,6 +416,12 @@ func GetOrgName(orgid int64) (models.Org, error) {
416 416
 	return org, err
417 417
 }
418 418
 
419
+func GetMyMobile(id int64) (models.SgjUserAdmin, error) {
420
+	admin := models.SgjUserAdmin{}
421
+	err := UserReadDB().Model(&admin).Where("id=? and status = 1", id).Find(&admin).Error
422
+	return admin, err
423
+}
424
+
419 425
 func CreateCulture(culture *models.DeviceCulture) error {
420 426
 
421 427
 	err := writeUserDb.Create(&culture).Error

+ 5 - 0
service/mobile_dialysis_service.go View File

@@ -557,6 +557,11 @@ func MobileGetLastTimeAssessmentAfterDislysis(orgID int64, patientID int64, maxD
557 557
 	}
558 558
 	return &record, nil
559 559
 }
560
+func MobileGetLast(orgID int64, patientID int64, maxDate int64) (models.AssessmentAfterDislysis, error) {
561
+	dislysis := models.AssessmentAfterDislysis{}
562
+	err := readDb.Model(&models.AssessmentAfterDislysis{}).Where("patient_id = ? and user_org_id = ? and status = 1 and assessment_date < ?", patientID, orgID, maxDate).Order("assessment_date desc").First(&dislysis).Error
563
+	return dislysis, err
564
+}
560 565
 
561 566
 // 治疗小结
562 567
 func MobileGetTreatmentSummary(orgID int64, patientID int64, recordDate int64) (*models.TreatmentSummary, error) {

+ 12 - 0
service/patientmanage_service.go View File

@@ -1310,6 +1310,12 @@ func CreateLoginLod(log *models.SgjUserAdminLoginLog) error {
1310 1310
 	return err
1311 1311
 }
1312 1312
 
1313
+func GetAppId(orgid int64) (models.OrgApp, error) {
1314
+	app := models.OrgApp{}
1315
+	err := UserReadDB().Model(&app).Where("org_id = ? and status = 1 and app_type = 3", orgid).Find(&app).Error
1316
+	return app, err
1317
+}
1318
+
1313 1319
 func GetRoleName(adminid int64, orgid int64, appid int64) (models.Roles, error) {
1314 1320
 
1315 1321
 	role := models.Roles{}
@@ -1317,6 +1323,12 @@ func GetRoleName(adminid int64, orgid int64, appid int64) (models.Roles, error)
1317 1323
 	return role, err
1318 1324
 }
1319 1325
 
1326
+func GetRole(id int64) (models.Role, error) {
1327
+	role := models.Role{}
1328
+	err := UserReadDB().Model(&role).Where("id = ? and status =1", id).Find(&role).Error
1329
+	return role, err
1330
+}
1331
+
1320 1332
 func GetPositionName(adminid int64, orgid int64, appid int64) (models.App_Role, error) {
1321 1333
 
1322 1334
 	role := models.App_Role{}