Browse Source

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

csx 4 years ago
parent
commit
46b2c2809f

+ 6 - 8
conf/app.conf View File

@@ -148,29 +148,27 @@ readmysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
148 148
 readmysqlport = 3306
149 149
 readmysqluser = root
150 150
 readmysqlpass = 1Q2W3e4r!@#$
151
-readmysqlname = test_xt
152
-//readmysqlname = sgj_xt
151
+readmysqlname = sgj_xt
153 152
 
154 153
 writemysqlhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
155 154
 writemysqlport = 3306
156 155
 writemysqluser = root
157 156
 writemysqlpass = 1Q2W3e4r!@#$
158
-writemysqlname = test_xt
159
-//writemysqlname = sgj_xt
157
+writemysqlname = sgj_xt
160 158
 
161 159
 readuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
162 160
 readuserport = 3306
163 161
 readuseruser = root
164 162
 readuserpass = 1Q2W3e4r!@#$
165
-readusername = test_users
166
-//readusername = test_users
163
+readusername = sgj_users
164
+
167 165
 
168 166
 writeuserhost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
169 167
 writeuserport = 3306
170 168
 writeuseruser = root
171 169
 writeuserpass = 1Q2W3e4r!@#$
172
-writeusername = test_users
173
-//writeusername = test_users
170
+writeusername = sgj_users
171
+
174 172
 
175 173
 
176 174
 readmiddlehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com

+ 59 - 60
controllers/base_api_controller.go View File

@@ -2,7 +2,6 @@ package controllers
2 2
 
3 3
 import (
4 4
 	"XT_New/enums"
5
-	"XT_New/models"
6 5
 	"XT_New/service"
7 6
 	"fmt"
8 7
 	"strconv"
@@ -65,36 +64,36 @@ type BaseAuthAPIController struct {
65 64
 func (this *BaseAuthAPIController) Prepare() {
66 65
 	this.BaseAPIController.Prepare()
67 66
 	if this.GetAdminUserInfo() == nil {
68
-		var userAdmin models.AdminUser
69
-		userAdmin.Id = 400
70
-		userAdmin.Mobile = "13535547901"
71
-
72
-		//userAdmin.Id = 597
73
-		//userAdmin.Mobile = "19874122664"
74
-		userAdmin.IsSuperAdmin = false
75
-		userAdmin.Status = 1
76
-		userAdmin.CreateTime = 1530786071
77
-		userAdmin.ModifyTime = 1530786071
78
-		var subscibe models.ServeSubscibe
79
-		subscibe.ID = 1
80
-		subscibe.OrgId = 12
81
-		subscibe.PeriodStart = 1538035409
82
-		subscibe.PeriodEnd = 1569571409
83
-		subscibe.State = 1
84
-		subscibe.Status = 1
85
-		subscibe.CreatedTime = 1538035409
86
-		subscibe.UpdatedTime = 1538035409
87
-		subscibes := make(map[int64]*models.ServeSubscibe, 0)
88
-		subscibes[4] = &subscibe
89
-		var adminUserInfo service.AdminUserInfo
90
-		adminUserInfo.CurrentOrgId = 12
91
-		adminUserInfo.CurrentAppId = 18
92
-		adminUserInfo.AdminUser = &userAdmin
93
-		adminUserInfo.Subscibes = subscibes
94
-		this.SetSession("admin_user_info", &adminUserInfo)
95
-
96
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
97
-		//this.StopRun()
67
+		//var userAdmin models.AdminUser
68
+		//userAdmin.Id = 400
69
+		//userAdmin.Mobile = "13535547901"
70
+		//
71
+		////userAdmin.Id = 597
72
+		////userAdmin.Mobile = "19874122664"
73
+		//userAdmin.IsSuperAdmin = false
74
+		//userAdmin.Status = 1
75
+		//userAdmin.CreateTime = 1530786071
76
+		//userAdmin.ModifyTime = 1530786071
77
+		//var subscibe models.ServeSubscibe
78
+		//subscibe.ID = 1
79
+		//subscibe.OrgId = 12
80
+		//subscibe.PeriodStart = 1538035409
81
+		//subscibe.PeriodEnd = 1569571409
82
+		//subscibe.State = 1
83
+		//subscibe.Status = 1
84
+		//subscibe.CreatedTime = 1538035409
85
+		//subscibe.UpdatedTime = 1538035409
86
+		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
87
+		//subscibes[4] = &subscibe
88
+		//var adminUserInfo service.AdminUserInfo
89
+		//adminUserInfo.CurrentOrgId = 12
90
+		//adminUserInfo.CurrentAppId = 18
91
+		//adminUserInfo.AdminUser = &userAdmin
92
+		//adminUserInfo.Subscibes = subscibes
93
+		//this.SetSession("admin_user_info", &adminUserInfo)
94
+
95
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
96
+		this.StopRun()
98 97
 	}
99 98
 
100 99
 	adminUserInfo := this.GetAdminUserInfo()
@@ -316,35 +315,35 @@ type BaseServeAPIController struct {
316 315
 func (this *BaseServeAPIController) Prepare() {
317 316
 	this.BaseAPIController.Prepare()
318 317
 	if this.GetAdminUserInfo() == nil {
319
-		var userAdmin models.AdminUser
320
-		userAdmin.Id = 400
321
-		userAdmin.Mobile = "13535547901"
322
-		//userAdmin.Id = 597
323
-		//userAdmin.Mobile = "19874122664"
324
-		userAdmin.IsSuperAdmin = false
325
-		userAdmin.Status = 1
326
-		userAdmin.CreateTime = 1530786071
327
-		userAdmin.ModifyTime = 1530786071
328
-		var subscibe models.ServeSubscibe
329
-		subscibe.ID = 1
330
-		subscibe.OrgId = 12
331
-		subscibe.PeriodStart = 1538035409
332
-		subscibe.PeriodEnd = 1569571409
333
-		subscibe.State = 1
334
-		subscibe.Status = 1
335
-		subscibe.CreatedTime = 1538035409
336
-		subscibe.UpdatedTime = 1538035409
337
-		subscibes := make(map[int64]*models.ServeSubscibe, 0)
338
-		subscibes[4] = &subscibe
339
-		var adminUserInfo service.AdminUserInfo
340
-		adminUserInfo.CurrentOrgId = 12
341
-		adminUserInfo.CurrentAppId = 18
342
-		adminUserInfo.AdminUser = &userAdmin
343
-		adminUserInfo.Subscibes = subscibes
344
-		this.SetSession("admin_user_info", &adminUserInfo)
345
-
346
-		//this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
347
-		//this.StopRun()
318
+		//var userAdmin models.AdminUser
319
+		//userAdmin.Id = 400
320
+		//userAdmin.Mobile = "13535547901"
321
+		////userAdmin.Id = 597
322
+		////userAdmin.Mobile = "19874122664"
323
+		//userAdmin.IsSuperAdmin = false
324
+		//userAdmin.Status = 1
325
+		//userAdmin.CreateTime = 1530786071
326
+		//userAdmin.ModifyTime = 1530786071
327
+		//var subscibe models.ServeSubscibe
328
+		//subscibe.ID = 1
329
+		//subscibe.OrgId = 12
330
+		//subscibe.PeriodStart = 1538035409
331
+		//subscibe.PeriodEnd = 1569571409
332
+		//subscibe.State = 1
333
+		//subscibe.Status = 1
334
+		//subscibe.CreatedTime = 1538035409
335
+		//subscibe.UpdatedTime = 1538035409
336
+		//subscibes := make(map[int64]*models.ServeSubscibe, 0)
337
+		//subscibes[4] = &subscibe
338
+		//var adminUserInfo service.AdminUserInfo
339
+		//adminUserInfo.CurrentOrgId = 12
340
+		//adminUserInfo.CurrentAppId = 18
341
+		//adminUserInfo.AdminUser = &userAdmin
342
+		//adminUserInfo.Subscibes = subscibes
343
+		//this.SetSession("admin_user_info", &adminUserInfo)
344
+
345
+		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
346
+		this.StopRun()
348 347
 	}
349 348
 
350 349
 	//if adminUserInfo.AppRole != nil {

+ 17 - 7
controllers/mobile_api_controllers/dialysis_api_controller.go View File

@@ -1017,11 +1017,6 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1017 1017
 	//}
1018 1018
 
1019 1019
 	//TODO 需要根据角色去判断
1020
-	if appRole.UserType == 2 || appRole.UserType == 1 {
1021
-		prescription_doctor = appRole.AdminUserId
1022
-	} else {
1023
-		prescription_doctor = 0
1024
-	}
1025 1020
 
1026 1021
 	prescription := models.DialysisPrescription{
1027 1022
 
@@ -1091,6 +1086,12 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
1091 1086
 		//if mode_id > 0 {
1092 1087
 		//	//service.ModifyScheduleMode(mode_id, patient.ID, recordDate.Unix(), adminUserInfo.Org.Id)
1093 1088
 		//}
1089
+		if appRole.UserType == 2 || appRole.UserType == 1 {
1090
+			prescription_doctor = adminUserInfo.AdminUser.Id
1091
+		} else {
1092
+			prescription_doctor = 0
1093
+		}
1094
+
1094 1095
 		prescription.Creater = adminUserInfo.AdminUser.Id
1095 1096
 		err := service.AddSigleRecord(&prescription)
1096 1097
 
@@ -2235,9 +2236,18 @@ func (c *DialysisAPIController) PostDialysisPrescription() {
2235 2236
 
2236 2237
 		prescription.CreatedTime = dialysisPrescription.CreatedTime
2237 2238
 		prescription.Modifier = adminUserInfo.AdminUser.Id
2238
-		prescription.Creater = adminUserInfo.AdminUser.Id
2239
+		if dialysisPrescription.Creater == 0 {
2240
+			prescription.Creater = adminUserInfo.AdminUser.Id
2241
+			if appRole.UserType == 2 || appRole.UserType == 1 {
2242
+				prescription_doctor = adminUserInfo.AdminUser.Id
2243
+				prescription.PrescriptionDoctor = dialysisPrescription.PrescriptionDoctor
2244
+			} else {
2245
+				prescription_doctor = 0
2246
+			}
2247
+		} else {
2248
+			prescription.Creater = dialysisPrescription.Creater
2249
+		}
2239 2250
 
2240
-		prescription.PrescriptionDoctor = adminUserInfo.AdminUser.Id
2241 2251
 		prescription.ID = dialysisPrescription.ID
2242 2252
 		err := service.UpDateDialysisPrescription(&prescription)
2243 2253
 		if err == nil {

+ 18 - 10
controllers/mobile_api_controllers/mobile_api_base_controller.go View File

@@ -49,7 +49,7 @@ type MobileBaseAPIAuthController struct {
49 49
 
50 50
 func (this *MobileBaseAPIAuthController) Prepare() {
51 51
 	token := this.Ctx.GetCookie("token_cookie")
52
-	//logout_cookie := this.Ctx.GetCookie("logout_cookie")
52
+	logout_cookie := this.Ctx.GetCookie("logout_cookie")
53 53
 
54 54
 	//if len(token) == 0{
55 55
 	//	this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
@@ -58,17 +58,25 @@ func (this *MobileBaseAPIAuthController) Prepare() {
58 58
 	this.MobileBaseAPIController.Prepare()
59 59
 	adminUserInfo := this.GetMobileAdminUserInfo()
60 60
 
61
-	if adminUserInfo == nil {
62
-		this.DelSession("mobile_admin_user_info")
63
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
64
-		this.StopRun()
65
-	}
66
-
61
+	fmt.Println(token)
67 62
 	if len(token) == 0 {
68
-
69 63
 		this.DelSession("mobile_admin_user_info")
70
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLoginTimeout)
71
-		this.StopRun()
64
+		fmt.Println(logout_cookie)
65
+		if len(logout_cookie) == 1 {
66
+			this.Ctx.SetCookie("logout_cookie", "2")
67
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLogOut)
68
+			this.StopRun()
69
+		} else {
70
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeLoginTimeout)
71
+			this.StopRun()
72
+		}
73
+
74
+	} else {
75
+		if adminUserInfo == nil {
76
+			this.DelSession("mobile_admin_user_info")
77
+			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNotLogin)
78
+			this.StopRun()
79
+		}
72 80
 	}
73 81
 
74 82
 	//if this.Ctx.Request.Method != "GET" {

+ 1 - 0
controllers/mobile_api_controllers/patient_api_controller.go View File

@@ -609,6 +609,7 @@ func (c *PatientApiController) ExecDoctorAdvice() {
609 609
 	advice.ExecutionStaff = execution_staff
610 610
 	advice.ExecutionTime = theTime.Unix()
611 611
 	advice.ExecutionState = 1
612
+	advice.Modifier = adminUserInfo.AdminUser.Id
612 613
 
613 614
 	c.ServeSuccessJSON(map[string]interface{}{
614 615
 		"msg":    "ok",

+ 2 - 2
controllers/new_mobile_api_controllers/home_api_controller.go View File

@@ -369,8 +369,8 @@ func (this *HomeController) CreateOrg() {
369 369
 		InitRoleAndPurviews(org)
370 370
 		//初始化设备管理
371 371
 		InitEquitMentInformation(org)
372
-		//初始化显示配置
373
-		//InitShowConfig(org)
372
+		//初始化显示配置和打印模版
373
+		InitShowConfig(org)
374 374
 
375 375
 		if len(orgs) == 0 {
376 376
 			ip := utils.GetIP(this.Ctx.Request)

+ 10 - 2
controllers/new_mobile_api_controllers/mobile_regist_controller.go View File

@@ -239,8 +239,8 @@ func (this *MobileRegistController) CreateOrg() {
239 239
 		InitRoleAndPurviews(org)
240 240
 		//初始化设备管理org
241 241
 		InitEquitMentInformation(org)
242
-		//初始化显示配置
243
-		//InitShowConfig(org)
242
+		//初始化显示配置和打印模版
243
+		InitShowConfig(org)
244 244
 
245 245
 		//创建完机构后进行登录验证操作
246 246
 		ip := utils.GetIP(this.Ctx.Request)
@@ -1174,4 +1174,12 @@ func InitEquitMentInformation(org *models.Org) {
1174 1174
 
1175 1175
 func InitShowConfig(org *models.Org) {
1176 1176
 	service.BatchInsertFiledSystemConfig(org.Id)
1177
+	template := &models.VMGobalTemplate{
1178
+		Status:     1,
1179
+		Ctime:      time.Now().Unix(),
1180
+		Mtime:      time.Now().Unix(),
1181
+		OrgId:      org.Id,
1182
+		TemplateId: 2,
1183
+	}
1184
+	service.CreateVMPrintTemplate(template)
1177 1185
 }

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

@@ -1997,8 +1997,6 @@ func (this *NewDialysisApiController) DeleteBed() {
1997 1997
 }
1998 1998
 
1999 1999
 func (this *NewDialysisApiController) LoginOut() {
2000
-
2001
-	this.DelSession("mobile_admin_user_info")
2002 2000
 	this.Ctx.SetCookie("logout_cookie", "1")
2003 2001
 	this.Ctx.SetCookie("token_cookie", "")
2004 2002
 	id, _ := this.GetInt64("id")

+ 2 - 2
controllers/new_mobile_api_controllers/patient.json View File

@@ -15,7 +15,7 @@
15 15
       "nation": "汉",
16 16
       "native_place": "广东深圳",
17 17
       "marital_status": 1,
18
-      "id_card_no": "431230199808081111",
18
+      "id_card_no": "999999190001019999",
19 19
       "birthday": -312537600,
20 20
       "reimbursement_way_id": 7,
21 21
       "health_care_type": 0,
@@ -95,7 +95,7 @@
95 95
       "nation": "汉",
96 96
       "native_place": "广东深圳",
97 97
       "marital_status": 1,
98
-      "id_card_no": "4312301999090952222",
98
+      "id_card_no": "999999190001018888",
99 99
       "birthday": -312537600,
100 100
       "reimbursement_way_id": 7,
101 101
       "health_care_type": 0,

+ 5 - 16
controllers/new_mobile_api_controllers/role.json View File

@@ -7,7 +7,7 @@
7 7
       "status": 1,
8 8
       "is_system": 1,
9 9
       "number": 9999,
10
-      "purview_ids": "71,72,70,74,75,73,48,49,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102",
10
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102,83,94",
11 11
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20039,20055,20056,20040,20041,20042,20043,20054,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030"
12 12
     },
13 13
     {
@@ -19,8 +19,6 @@
19 19
       "number": 9998,
20 20
       "purview_ids": "71,72,70,74,75,73,48,52,110,77,78,79,80,197,76,93,121,122,124,125,120,127,128,193,194,196,192,101,100,102,49",
21 21
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20029,20030"
22
-
23
-
24 22
     },
25 23
     {
26 24
       "role_name": "护士",
@@ -29,21 +27,17 @@
29 27
       "status": 1,
30 28
       "is_system": 3,
31 29
       "number": 9997,
32
-      "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76",
30
+      "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76,83,94",
33 31
       "func_ids": "20007,20008,20009,20010,20011,20051,20053,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20029,20055,20056,20052,20012"
34
-    },
35
-    {
32
+    },{
36 33
       "role_name": "库存",
37 34
       "role_introduction": "库存角色负责透析耗材的日常管理,对耗材的入库、出库、退库的登记操作",
38 35
       "is_super_admin": false,
39 36
       "status": 1,
40 37
       "is_system": 0,
41 38
       "number": 9996,
42
-      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84",
39
+      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84,83,94",
43 40
       "func_ids": ""
44
-
45
-
46
-
47 41
     },{
48 42
       "role_name": "运营",
49 43
       "role_introduction": "运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作",
@@ -53,9 +47,6 @@
53 47
       "number": 9995,
54 48
       "purview_ids": "48,110,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
55 49
       "func_ids": ""
56
-
57
-
58
-
59 50
     },{
60 51
       "role_name": "技师",
61 52
       "role_introduction": "技师角色能够进行设备的管理,日常维护维修记录等",
@@ -65,8 +56,6 @@
65 56
       "number": 9994,
66 57
       "purview_ids": "77,78,79,80,197,76",
67 58
       "func_ids": ""
68
-
69
-
70 59
     },
71 60
     {
72 61
       "role_name": "院长",
@@ -75,7 +64,7 @@
75 64
       "status": 1,
76 65
       "is_system": 0,
77 66
       "number": 9993,
78
-      "purview_ids": "71,72,70,74,75,73,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,197,76,101,100,102,127,128,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
67
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,197,76,101,100,102,127,128,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201,83,94",
79 68
       "func_ids": ""
80 69
 
81 70
 

+ 78 - 93
controllers/patient_api_controller.go View File

@@ -243,29 +243,29 @@ func (c *PatientApiController) CreatePatient() {
243 243
 	//获取老表的最后一条数据
244 244
 	patients, err := service.GetLastPatientData(adminUserInfo.CurrentOrgId)
245 245
 	patientsNew := models.XtPatientsNew{
246
-		UserOrgId:                    adminUserInfo.CurrentOrgId,
247
-		UserId:                       0,
248
-		Avatar:                       patients.Avatar,
249
-		PatientType:                  patients.PatientType,
250
-		DialysisNo:                   patients.DialysisNo,
251
-		AdmissionNumber:              patients.AdmissionNumber,
252
-		Source:                       patients.Source,
253
-		Lapseto:                      patients.Lapseto,
254
-		PartitionId:                  patients.PartitionId,
255
-		BedId:                        patients.BedId,
256
-		Name:                         patients.Name,
257
-		Alias:                        patients.Alias,
258
-		Gender:                       patients.Gender,
259
-		MaritalStatus:                patients.MaritalStatus,
260
-		IdCardNo:                     patients.IdCardNo,
261
-		Birthday:                     patients.Birthday,
262
-		ReimbursementWayId:           patients.ReimbursementWayId,
263
-		HealthCareType:               patients.HealthCareType,
264
-		HealthCareNo:                 patients.HealthCareNo,
265
-		HealthCareDueDate:            patients.HealthCareDueDate,
266
-		Height:                       patients.Height,
267
-		BloodType:                    patients.BloodType,
268
-		Rh:                           patients.Rh,
246
+		UserOrgId:          adminUserInfo.CurrentOrgId,
247
+		UserId:             0,
248
+		Avatar:             patients.Avatar,
249
+		PatientType:        patients.PatientType,
250
+		DialysisNo:         patients.DialysisNo,
251
+		AdmissionNumber:    patients.AdmissionNumber,
252
+		Source:             patients.Source,
253
+		Lapseto:            patients.Lapseto,
254
+		PartitionId:        patients.PartitionId,
255
+		BedId:              patients.BedId,
256
+		Name:               patients.Name,
257
+		Alias:              patients.Alias,
258
+		Gender:             patients.Gender,
259
+		MaritalStatus:      patients.MaritalStatus,
260
+		IdCardNo:           patients.IdCardNo,
261
+		Birthday:           patients.Birthday,
262
+		ReimbursementWayId: patients.ReimbursementWayId,
263
+		HealthCareType:     patients.HealthCareType,
264
+		HealthCareNo:       patients.HealthCareNo,
265
+		HealthCareDueDate:  patients.HealthCareDueDate,
266
+		Height:             patients.Height,
267
+		BloodType:          patients.BloodType,
268
+		Rh:                 patients.Rh,
269 269
 		HealthCareDueAlertDate:       patients.HealthCareDueAlertDate,
270 270
 		EducationLevel:               patients.EducationLevel,
271 271
 		Profession:                   patients.Profession,
@@ -311,27 +311,27 @@ func (c *PatientApiController) CreatePatient() {
311 311
 		Nation:                       patients.Nation,
312 312
 		NativePlace:                  patients.NativePlace,
313 313
 		Age:                          patients.Age,
314
-		InfectiousNextRecordTime:     patients.InfectiousNextRecordTime,
315
-		IsInfectious:                 patients.IsInfectious,
316
-		RemindCycle:                  patients.RemindCycle,
317
-		ResponseResult:               patients.ResponseResult,
318
-		IsOpenRemind:                 patients.IsOpenRemind,
319
-		FirstTreatmentDate:           patients.FirstTreatmentDate,
320
-		DialysisAge:                  patients.DialysisAge,
321
-		ExpenseKind:                  patients.ExpenseKind,
322
-		TellPhone:                    patients.TellPhone,
323
-		ContactName:                  patients.ContactName,
324
-		BloodPatients:                1,
325
-		SlowPatients:                 0,
326
-		MemberPatients:               0,
327
-		EcommerPatients:              "",
328
-		BloodId:                      patients.ID,
329
-		SlowId:                       0,
330
-		MemberId:                     0,
331
-		MemberFistdate:               0,
332
-		MemberPatienttype:            0,
333
-		MemberTreatement:             0,
334
-		EquitmentId:                  "",
314
+		InfectiousNextRecordTime: patients.InfectiousNextRecordTime,
315
+		IsInfectious:             patients.IsInfectious,
316
+		RemindCycle:              patients.RemindCycle,
317
+		ResponseResult:           patients.ResponseResult,
318
+		IsOpenRemind:             patients.IsOpenRemind,
319
+		FirstTreatmentDate:       patients.FirstTreatmentDate,
320
+		DialysisAge:              patients.DialysisAge,
321
+		ExpenseKind:              patients.ExpenseKind,
322
+		TellPhone:                patients.TellPhone,
323
+		ContactName:              patients.ContactName,
324
+		BloodPatients:            1,
325
+		SlowPatients:             0,
326
+		MemberPatients:           0,
327
+		EcommerPatients:          "",
328
+		BloodId:                  patients.ID,
329
+		SlowId:                   0,
330
+		MemberId:                 0,
331
+		MemberFistdate:           0,
332
+		MemberPatienttype:        0,
333
+		MemberTreatement:         0,
334
+		EquitmentId:              "",
335 335
 	}
336 336
 
337 337
 	err = service.CreatePatientsNew(&patientsNew)
@@ -459,29 +459,29 @@ func (c *PatientApiController) EditPatient() {
459 459
 	}
460 460
 	fmt.Println("病人--------------------------------------------------------------", patient.Name, patient.Age)
461 461
 	patientsNew := models.XtPatientsNew{
462
-		UserOrgId:                 patient.UserOrgId,
463
-		UserId:                    patient.UserId,
464
-		Avatar:                    patient.Avatar,
465
-		PatientType:               patient.PatientType,
466
-		DialysisNo:                patient.DialysisNo,
467
-		AdmissionNumber:           patient.AdmissionNumber,
468
-		Source:                    patient.Source,
469
-		Lapseto:                   patient.Lapseto,
470
-		PartitionId:               patient.PartitionId,
471
-		BedId:                     patient.BedId,
472
-		Name:                      patient.Name,
473
-		Alias:                     patient.Alias,
474
-		Gender:                    patient.Gender,
475
-		MaritalStatus:             patient.MaritalStatus,
476
-		IdCardNo:                  patient.IdCardNo,
477
-		Birthday:                  patient.Birthday,
478
-		ReimbursementWayId:        patient.ReimbursementWayId,
479
-		HealthCareType:            patient.HealthCareType,
480
-		HealthCareNo:              patient.HealthCareNo,
481
-		HealthCareDueDate:         patient.HealthCareDueDate,
482
-		Height:                    patient.Height,
483
-		BloodType:                 patient.BloodType,
484
-		Rh:                        patient.Rh,
462
+		UserOrgId:          patient.UserOrgId,
463
+		UserId:             patient.UserId,
464
+		Avatar:             patient.Avatar,
465
+		PatientType:        patient.PatientType,
466
+		DialysisNo:         patient.DialysisNo,
467
+		AdmissionNumber:    patient.AdmissionNumber,
468
+		Source:             patient.Source,
469
+		Lapseto:            patient.Lapseto,
470
+		PartitionId:        patient.PartitionId,
471
+		BedId:              patient.BedId,
472
+		Name:               patient.Name,
473
+		Alias:              patient.Alias,
474
+		Gender:             patient.Gender,
475
+		MaritalStatus:      patient.MaritalStatus,
476
+		IdCardNo:           patient.IdCardNo,
477
+		Birthday:           patient.Birthday,
478
+		ReimbursementWayId: patient.ReimbursementWayId,
479
+		HealthCareType:     patient.HealthCareType,
480
+		HealthCareNo:       patient.HealthCareNo,
481
+		HealthCareDueDate:  patient.HealthCareDueDate,
482
+		Height:             patient.Height,
483
+		BloodType:          patient.BloodType,
484
+		Rh:                 patient.Rh,
485 485
 		HealthCareDueAlertDate:    patient.HealthCareDueAlertDate,
486 486
 		EducationLevel:            patient.EducationLevel,
487 487
 		Profession:                patient.Profession,
@@ -523,17 +523,17 @@ func (c *PatientApiController) EditPatient() {
523 523
 		Nation:                    patient.Nation,
524 524
 		NativePlace:               patient.NativePlace,
525 525
 		Age:                       patient.Age,
526
-		InfectiousNextRecordTime:  patient.InfectiousNextRecordTime,
527
-		IsInfectious:              patient.IsInfectious,
528
-		RemindCycle:               patient.RemindCycle,
529
-		ResponseResult:            patient.ResponseResult,
530
-		IsOpenRemind:              patient.IsOpenRemind,
531
-		FirstTreatmentDate:        patient.FirstTreatmentDate,
532
-		DialysisAge:               patient.DialysisAge,
533
-		ExpenseKind:               patient.ExpenseKind,
534
-		TellPhone:                 patient.TellPhone,
535
-		ContactName:               patient.ContactName,
536
-		UpdatedTime:               time.Now().Unix(),
526
+		InfectiousNextRecordTime: patient.InfectiousNextRecordTime,
527
+		IsInfectious:             patient.IsInfectious,
528
+		RemindCycle:              patient.RemindCycle,
529
+		ResponseResult:           patient.ResponseResult,
530
+		IsOpenRemind:             patient.IsOpenRemind,
531
+		FirstTreatmentDate:       patient.FirstTreatmentDate,
532
+		DialysisAge:              patient.DialysisAge,
533
+		ExpenseKind:              patient.ExpenseKind,
534
+		TellPhone:                patient.TellPhone,
535
+		ContactName:              patient.ContactName,
536
+		UpdatedTime:              time.Now().Unix(),
537 537
 	}
538 538
 	//	//更新病人ID获取新表病人ID
539 539
 	err = service.UpdatepatientTwo(&patientsNew, id)
@@ -1547,11 +1547,6 @@ func (c *PatientApiController) CheckGroupAdvice() {
1547 1547
 		return
1548 1548
 	}
1549 1549
 
1550
-	if advice.ExecutionStaff == 0 {
1551
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceCheckBeforeExce)
1552
-		return
1553
-	}
1554
-
1555 1550
 	if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
1556 1551
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
1557 1552
 		return
@@ -1561,11 +1556,6 @@ func (c *PatientApiController) CheckGroupAdvice() {
1561 1556
 
1562 1557
 	theTime := time.Now()
1563 1558
 
1564
-	//if advice.ExecutionTime > theTime.Unix() {
1565
-	//	c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceExceBeforeStart)
1566
-	//	return
1567
-	//}
1568
-
1569 1559
 	exceAdvice := models.DoctorAdvice{
1570 1560
 		Checker:     checker,
1571 1561
 		CheckTime:   theTime.Unix(),
@@ -1614,11 +1604,6 @@ func (c *PatientApiController) CheckDoctorAdvice() {
1614 1604
 		return
1615 1605
 	}
1616 1606
 
1617
-	if advice.ExecutionStaff == 0 {
1618
-		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeAdviceCheckBeforeExce)
1619
-		return
1620
-	}
1621
-
1622 1607
 	if advice.ExecutionStaff >= 0 && advice.ExecutionStaff == adminUserInfo.AdminUser.Id {
1623 1608
 		c.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeExceAndCheckNotOneUser)
1624 1609
 		return

+ 44 - 40
controllers/public_api_controller.go View File

@@ -165,7 +165,7 @@ func (this *PublicApiController) GetJson() {
165 165
 func (c *PublicApiController) HandleData() {
166 166
 	//org_app, _ := service.GetAllAppOrg()
167 167
 	//org_role, _ := service.GetAllRole()
168
-
168
+	//
169 169
 	//var org_ids []int64
170 170
 
171 171
 	//for _, apps := range org_app {
@@ -486,10 +486,10 @@ func (c *PublicApiController) HandleData() {
486 486
 	//
487 487
 	//
488 488
 	////创建内置角色
489
-	//InitRoleAndPurviews(org_ids)
489
+	InitRoleAndPurviews(org_ids)
490 490
 
491 491
 	//var org_id int = 0
492
-	////管理员
492
+	//管理员
493 493
 	//app_roles  := service.GetAllUserRoleByUserTypeOne(org_id)
494 494
 	//for _, item := range app_roles{
495 495
 	//	var ids string
@@ -500,7 +500,7 @@ func (c *PublicApiController) HandleData() {
500 500
 	//	}
501 501
 	//	service.UpdateRoleIds(item.Id, ids)
502 502
 	//}
503
-	////护士医生
503
+	//护士医生
504 504
 	//app_roles2  := service.GetAllUserRoleByUserTypeOther()
505 505
 	//	for _, item := range app_roles2{
506 506
 	//		var ids string
@@ -529,49 +529,53 @@ func InitRoleAndPurviews(org_ids []int64) {
529 529
 	roles := LoadRoleConfig("./role.json").Roles
530 530
 	for _, org_id := range org_ids {
531 531
 		app, _ := service.GetOrgAppB(org_id, 3)
532
+		role, _ := service.GetSystemRole(org_id)
533
+
532 534
 		if app == nil || app.Id == 0 {
533 535
 			continue
534 536
 		}
535
-		for _, item := range roles {
536
-			role := &models.Role{
537
-				RoleName:     item.RoleName,
538
-				RoleIntro:    item.RoleIntroduction,
539
-				Creator:      0,
540
-				OrgId:        org_id,
541
-				AppId:        app.Id,
542
-				IsSuperAdmin: false,
543
-				Status:       1,
544
-				CreateTime:   time.Now().Unix(),
545
-				ModifyTime:   time.Now().Unix(),
546
-				Number:       item.Number,
547
-				IsSystem:     item.IsSystem,
548
-			}
549
-			err := service.CreateOrgRoleB(role)
550
-			if err == nil {
551
-				purview := &models.RolePurview{
552
-					RoleId:     role.Id,
553
-					OrgId:      org_id,
554
-					AppId:      role.AppId,
555
-					PurviewIds: item.PurviewIds,
556
-					Status:     1,
557
-					CreateTime: time.Now().Unix(),
558
-					ModifyTime: time.Now().Unix(),
537
+		if len(role) == 0 {
538
+			for _, item := range roles {
539
+				role := &models.Role{
540
+					RoleName:     item.RoleName,
541
+					RoleIntro:    item.RoleIntroduction,
542
+					Creator:      0,
543
+					OrgId:        org_id,
544
+					AppId:        app.Id,
545
+					IsSuperAdmin: false,
546
+					Status:       1,
547
+					CreateTime:   time.Now().Unix(),
548
+					ModifyTime:   time.Now().Unix(),
549
+					Number:       item.Number,
550
+					IsSystem:     item.IsSystem,
559 551
 				}
560
-				func_purview := &models.SgjUserRoleFuncPurview{
561
-					RoleId:     role.Id,
562
-					OrgId:      org_id,
563
-					AppId:      role.AppId,
564
-					PurviewIds: item.FuncIds,
565
-					Status:     1,
566
-					Ctime:      time.Now().Unix(),
567
-					Mtime:      time.Now().Unix(),
552
+				err := service.CreateOrgRoleB(role)
553
+				if err == nil {
554
+					purview := &models.RolePurview{
555
+						RoleId:     role.Id,
556
+						OrgId:      org_id,
557
+						AppId:      role.AppId,
558
+						PurviewIds: item.PurviewIds,
559
+						Status:     1,
560
+						CreateTime: time.Now().Unix(),
561
+						ModifyTime: time.Now().Unix(),
562
+					}
563
+					func_purview := &models.SgjUserRoleFuncPurview{
564
+						RoleId:     role.Id,
565
+						OrgId:      org_id,
566
+						AppId:      role.AppId,
567
+						PurviewIds: item.FuncIds,
568
+						Status:     1,
569
+						Ctime:      time.Now().Unix(),
570
+						Mtime:      time.Now().Unix(),
571
+					}
572
+
573
+					service.CreateRolePurviewB(purview)
574
+					service.CreateFuncRolePurviewB(func_purview)
568 575
 				}
569
-
570
-				service.CreateRolePurviewB(purview)
571
-				service.CreateFuncRolePurviewB(func_purview)
572 576
 			}
573
-		}
574 577
 
578
+		}
575 579
 	}
576 580
 
577 581
 }

+ 4 - 16
controllers/role.json View File

@@ -7,7 +7,7 @@
7 7
       "status": 1,
8 8
       "is_system": 1,
9 9
       "number": 9999,
10
-      "purview_ids": "71,72,70,74,75,73,48,49,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102",
10
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,49,77,78,79,80,197,76,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,127,128,201,193,194,196,192,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,101,100,102,83,94",
11 11
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20039,20055,20056,20040,20041,20042,20043,20054,20044,20045,20046,20047,20048,20049,20050,20051,20052,20053,20013,20014,20015,20016,20017,20018,20019,20020,20021,20022,20023,20024,20025,20026,20027,20028,20029,20030"
12 12
     },
13 13
     {
@@ -19,8 +19,6 @@
19 19
       "number": 9998,
20 20
       "purview_ids": "71,72,70,74,75,73,48,52,110,77,78,79,80,197,76,93,121,122,124,125,120,127,128,193,194,196,192,101,100,102,49",
21 21
       "func_ids": "20001,20002,20003,20004,20005,20006,20007,20008,20009,20010,20011,20012,20034,20035,20036,20038,20040,20041,20043,20044,20046,20047,20049,20024,20025,20026,20027,20028,20029,20030"
22
-
23
-
24 22
     },
25 23
     {
26 24
       "role_name": "护士",
@@ -29,7 +27,7 @@
29 27
       "status": 1,
30 28
       "is_system": 3,
31 29
       "number": 9997,
32
-      "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76",
30
+      "purview_ids": "71,72,70,74,75,73,127,128,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,77,78,79,80,197,76,83,94",
33 31
       "func_ids": "20007,20008,20009,20010,20011,20051,20053,20013,20014,20016,20017,20019,20021,20022,20024,20025,20026,20027,20028,20029,20055,20056,20052,20012"
34 32
     },{
35 33
       "role_name": "库存",
@@ -38,11 +36,8 @@
38 36
       "status": 1,
39 37
       "is_system": 0,
40 38
       "number": 9996,
41
-      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84",
39
+      "purview_ids": "111,112,113,114,115,116,117,118,119,129,84,94",
42 40
       "func_ids": ""
43
-
44
-
45
-
46 41
     },{
47 42
       "role_name": "运营",
48 43
       "role_introduction": "运营角色能够在SCRM中管理微网站、使用营销工具、做会员管理和分销商品经营的操作",
@@ -52,9 +47,6 @@
52 47
       "number": 9995,
53 48
       "purview_ids": "48,110,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
54 49
       "func_ids": ""
55
-
56
-
57
-
58 50
     },{
59 51
       "role_name": "技师",
60 52
       "role_introduction": "技师角色能够进行设备的管理,日常维护维修记录等",
@@ -64,8 +56,6 @@
64 56
       "number": 9994,
65 57
       "purview_ids": "77,78,79,80,197,76",
66 58
       "func_ids": ""
67
-
68
-
69 59
     },
70 60
     {
71 61
       "role_name": "院长",
@@ -74,10 +64,8 @@
74 64
       "status": 1,
75 65
       "is_system": 0,
76 66
       "number": 9993,
77
-      "purview_ids": "71,72,70,74,75,73,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,197,76,101,100,102,127,128,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201",
67
+      "purview_ids": "71,72,70,74,75,73,48,49,52,110,111,112,113,114,115,116,117,118,119,129,84,93,121,122,124,125,120,77,78,79,80,197,76,101,100,102,127,128,158,157,159,160,161,162,167,166,168,169,170,171,174,173,175,178,177,179,201,94",
78 68
       "func_ids": ""
79
-
80
-
81 69
     }
82 70
   ]
83 71
 }

+ 27 - 2
controllers/verify_login_controller.go View File

@@ -8,6 +8,7 @@ import (
8 8
 	"fmt"
9 9
 	"github.com/astaxie/beego"
10 10
 	"net/url"
11
+	"regexp"
11 12
 	"strconv"
12 13
 	"strings"
13 14
 )
@@ -186,16 +187,31 @@ func (this *VerifyUserLoginAPIController) VerifyToken() {
186 187
 						var ids string
187 188
 						for _, role_id := range role_arr {
188 189
 							id, _ := strconv.ParseInt(role_id, 10, 64)
189
-
190
+							role, _ := service.GetRoleByRoleID(id)
191
+							var system_ids = ""
192
+							if role.RoleName == "子管理员" && role.IsSystem > 0 {
193
+								purviews, _ := service.GetSystemPurview()
194
+								for _, purview := range purviews {
195
+									if len(system_ids) == 0 {
196
+										system_ids = strconv.FormatInt(purview.Id, 10)
197
+									} else {
198
+										system_ids = system_ids + "," + strconv.FormatInt(purview.Id, 10)
199
+									}
200
+								}
201
+							}
190 202
 							purview_ids, _ := service.GetRolePurviewIds(id)
191 203
 							if len(ids) == 0 {
192 204
 								ids = purview_ids
193 205
 							} else {
194 206
 								ids = ids + "," + purview_ids
195 207
 							}
208
+
209
+							if len(system_ids) > 0 {
210
+								ids = ids + "," + system_ids
211
+							}
196 212
 						}
197 213
 						if len(ids) != 0 {
198
-							pruviews, _ = service.GetPurviewById(ids)
214
+							pruviews, _ = service.GetPurviewById(CompressStr(ids))
199 215
 							for _, item := range pruviews {
200 216
 								if item.Module == 3 && item.Parentid > 0 {
201 217
 									fmt.Println(item.Urlfor)
@@ -362,3 +378,12 @@ func (this *PersonAPIController) ModifyPwd() {
362 378
 		"msg": "密码已修改",
363 379
 	})
364 380
 }
381
+
382
+func CompressStr(str string) string {
383
+	if str == "" {
384
+		return ""
385
+	}
386
+	//匹配一个或多个空白符的正则表达式
387
+	reg := regexp.MustCompile("\\s+")
388
+	return reg.ReplaceAllString(str, "")
389
+}

+ 13 - 0
models/vm_models.go View File

@@ -317,3 +317,16 @@ type VMUserRoleAndPurview struct {
317 317
 func (VMUserRoleAndPurview) TableName() string {
318 318
 	return "sgj_user_role"
319 319
 }
320
+
321
+type VMGobalTemplate struct {
322
+	ID         int64 `gorm:"column:id" json:"id" form:"id"`
323
+	OrgId      int64 `gorm:"column:org_id" json:"org_id" form:"org_id"`
324
+	TemplateId int64 `gorm:"column:template_id" json:"template_id" form:"template_id"`
325
+	Status     int64 `gorm:"column:status" json:"status" form:"status"`
326
+	Ctime      int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
327
+	Mtime      int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
328
+}
329
+
330
+func (VMGobalTemplate) TableName() string {
331
+	return "xt_gobal_template"
332
+}

+ 9 - 0
service/app_version.go View File

@@ -173,3 +173,12 @@ func CreateFuncRolePurviewB(purview *models.SgjUserRoleFuncPurview) (err error)
173 173
 	err = writeUserDb.Create(&purview).Error
174 174
 	return
175 175
 }
176
+
177
+func GetSystemRole(orgID int64) ([]*models.Role, error) {
178
+	var roles []*models.Role
179
+	err := readUserDb.Where(" org_id = ? AND status = 1 AND is_system > 1", orgID).First(&roles).Error
180
+	if err != nil {
181
+		return nil, err
182
+	}
183
+	return roles, nil
184
+}

+ 1 - 0
service/patient_service.go View File

@@ -972,6 +972,7 @@ func UpdateAdviceGroupStartTime(orgID int64, groupNO int64, startTime int64, adm
972 972
 	err := writeDb.Model(&models.DoctorAdvice{}).Where("user_org_id = ? AND status = 1 AND execution_state <> 1 AND check_state <> 1 AND groupno = ? AND admin_user_id = ?", orgID, groupNO, admin_user_id).Updates(map[string]interface{}{
973 973
 		"start_time":   startTime,
974 974
 		"updated_time": now,
975
+		"modifier":     admin_user_id,
975 976
 	}).Error
976 977
 	return err
977 978
 }

+ 5 - 0
service/role_service.go View File

@@ -754,3 +754,8 @@ func FindAllFuncPurview(ids []string) (purview []*models.SgjUserOperatePurview,
754 754
 	return
755 755
 
756 756
 }
757
+
758
+func GetSystemPurview() (purview []*models.Purview, err error) {
759
+	err = readUserDb.Model(&models.Purview{}).Where("status = 1 AND module = 3 AND super_admin_exclusive = 1").Find(&purview).Error
760
+	return
761
+}

+ 5 - 0
service/vm_service.go View File

@@ -76,3 +76,8 @@ func CreatedTreateMode(treatmentmode *models.VmDeviceTreatmentmode) {
76 76
 	XTWriteDB().Model(&models.VmDeviceTreatmentmode{}).Create(&treatmentmode)
77 77
 
78 78
 }
79
+
80
+func CreateVMPrintTemplate(template *models.VMGobalTemplate) (err error) {
81
+	err = writeDb.Model(&models.VMGobalTemplate{}).Create(template).Error
82
+	return
83
+}