陈少旭 vor 7 Monaten
Ursprung
Commit
65e8a05147

+ 14 - 1
conf/app.conf Datei anzeigen

@@ -1,5 +1,5 @@
1 1
 appname = 血透
2
-httpport = 9550
2
+httpport = 9588
3 3
 runmode = dev
4 4
 
5 5
 copyrequestbody = true
@@ -107,6 +107,19 @@ writeuseruser = root
107 107
 writeuserpass = 1Q2W3e4r!@#$
108 108
 writeusername = sgj_users
109 109
 
110
+
111
+readchargehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
112
+readchargeport = 3306
113
+readchargeuser = root
114
+readchargepass = 1Q2W3e4r!@#$
115
+readchargename = kyy_charge
116
+
117
+writechargehost = rm-wz9rg531npf61q03tro.mysql.rds.aliyuncs.com
118
+writechargeport = 3306
119
+writechargeuser = root
120
+writechargepass = 1Q2W3e4r!@#$
121
+writechargename = kyy_charge
122
+
110 123
 redishost = 120.77.235.13
111 124
 redisport = 6379
112 125
 redispasswrod = syh@#$%123456!

+ 47 - 38
controllers/admin_api_controllers/admin_api_router_register.go Datei anzeigen

@@ -4,52 +4,61 @@ import "github.com/astaxie/beego"
4 4
 
5 5
 // 管理员后台路由,以 /admin/api 为前缀
6 6
 func AdminAPIControllersRegisterRouters() {
7
-	beego.Router("/admin/api/login/pwd", &LoginAPIController{}, "post:LoginByPwd")
8
-
9
-	//beego.Router("/admin/api/org/regist", &AnalysisAPIController{}, "get:RegistOrg")
10
-	//beego.Router("/admin/api/org/active", &AnalysisAPIController{}, "get:ActiveOrg")
11
-	//beego.Router("/admin/api/user/active", &AnalysisAPIController{}, "get:ActiveUser")
12
-	//beego.Router("/admin/api/org/expiring", &AnalysisAPIController{}, "get:ExpiringOrg")
13
-	//beego.Router("/admin/api/dialysis/analysis", &AnalysisAPIController{}, "get:DialysisAnalysis")
14
-	//beego.Router("/admin/api/monitor/analysis", &AnalysisAPIController{}, "get:MonitorAnalysis")
15
-	//beego.Router("/admin/api/patient/analysis", &AnalysisAPIController{}, "get:PatientAnalysis")
16
-	beego.Router("/admin/api/home/statistics", &AnalysisAPIController{}, "get:HomeStatistics")
17
-	beego.Router("/admin/api/getdistrictsbyupid", &OrgAPIController{}, "get:GetDistrictsByUpid")
18
-	beego.Router("/admin/api/org", &OrgAPIController{}, "get:GetOrgList")
19
-	beego.Router("/admin/api/org/initdata", &OrgAPIController{}, "get:GetInitData")
20
-	beego.Router("/admin/api/orginfo", &OrgAPIController{}, "get:GetOrgInfo")
21
-	beego.Router("/admin/api/org/statistics", &OrgAPIController{}, "get:GetOrgDialysisOrderStatistics")
22
-
23
-	beego.Router("/admin/api/org/patient", &OrgAPIController{}, "get:GetOrgPatientList")
24
-	beego.Router("/admin/api/org/role", &OrgAPIController{}, "get:GetOrgRoleList")
25
-	beego.Router("/admin/api/org/adminuser", &OrgAPIController{}, "get:GetOrgAdminUser")
26
-	beego.Router("/admin/api/org/zones", &OrgAPIController{}, "get:GetOrgZones")
27
-	beego.Router("/admin/api/org/group", &OrgAPIController{}, "get:GetOrgGroup")
28
-	beego.Router("/admin/api/org/bed", &OrgAPIController{}, "get:GetOrgBed")
29
-
30
-	beego.Router("admin/api/system/user", &SystemApiController{}, "get:GetUserList")
7
+	beego.Router("/admin/api/login/pwd", &LoginAPIController{}, "get:LoginByPwd")
8
+	beego.Router("/admin/api/system/user", &SystemApiController{}, "get:GetUserList")
31 9
 	beego.Router("/admin/api/user/create", &SystemApiController{}, "post:CreateAdminUser")
10
+	beego.Router("/admin/api/user/info", &SystemApiController{}, "get:GetAdminUserInfo")
32 11
 	beego.Router("/admin/api/user/edit", &SystemApiController{}, "post:ModifyAdminUser")
33 12
 	beego.Router("/admin/api/user/delete", &SystemApiController{}, "post:DeleteAdminUser")
13
+	//beego.Router("/admin/api/orgs/list", &SystemApiController{}, "get:GetOrgs")
14
+
15
+	beego.Router("/admin/api/home/statistics", &AnalysisAPIController{}, "get:HomeStatistics")
16
+	beego.Router("/admin/api/custom/create", &CustomAPIController{}, "post:CreateCustom")
17
+	beego.Router("/admin/api/custom/edit", &CustomAPIController{}, "post:ModifyCustom")
18
+	beego.Router("/admin/api/custom/list", &CustomAPIController{}, "get:GetCustomList")
19
+	beego.Router("/admin/api/custom/get", &CustomAPIController{}, "get:GetCustom")
20
+	beego.Router("/admin/api/checkcustom/get", &CustomAPIController{}, "get:GetWaitCheckCustom")
34 21
 
35
-	beego.Router("/admin/api/user/init", &SystemApiController{}, "get:GetUserInitData")
36
-	beego.Router("/admin/api/user/followorg", &SystemApiController{}, "get:GetFollowOrg")
37
-	beego.Router("/admin/api/follow", &SystemApiController{}, "post:PostFollowInfo")
22
+	beego.Router("/admin/api/paymentcollection/create", &CustomAPIController{}, "post:CreatePaymentCollection")
23
+	beego.Router("/admin/api/paymentcollection/get", &CustomAPIController{}, "get:GetPaymentCollection")
24
+	beego.Router("/admin/api/paymentcollection/list", &CustomAPIController{}, "get:GetPaymentCollectionList")
25
+	beego.Router("/admin/api/paymentcollection/edit", &CustomAPIController{}, "post:EditPaymentCollection")
26
+	beego.Router("/admin/api/paymentcollection/delete", &CustomAPIController{}, "post:DeletePaymentCollection")
27
+	beego.Router("/admin/api/paymentcollection/check", &CustomAPIController{}, "post:CheckPaymentCollection")
38 28
 
39
-	beego.Router("/admin/api/follow/edit", &SystemApiController{}, "post:ModifyFollowInfo")
40
-	beego.Router("/admin/api/unfollow", &SystemApiController{}, "post:PostUnFollow")
29
+	beego.Router("/admin/api/contact/create", &CustomAPIController{}, "post:CreateContactInfo")
30
+	beego.Router("/admin/api/contact/get", &CustomAPIController{}, "get:GetContactInfo")
31
+	beego.Router("/admin/api/contact/list", &CustomAPIController{}, "get:GetContactInfoList")
32
+	beego.Router("/admin/api/contact/edit", &CustomAPIController{}, "post:EditContactInfo")
33
+	beego.Router("/admin/api/contact/delete", &CustomAPIController{}, "post:DeleteContactInfo")
34
+	beego.Router("/admin/api/contact/check", &CustomAPIController{}, "post:CheckContactInfo")
41 35
 
42
-	beego.Router("/admin/api/user/get", &SystemApiController{}, "get:GetAdminUserById")
43
-	beego.Router("/admin/api/follow/cancel", &SystemApiController{}, "post:CancelFollowInfo")
36
+	beego.Router("/admin/api/contract/create", &CustomAPIController{}, "post:CreateContractInfo")
37
+	beego.Router("/admin/api/contract/get", &CustomAPIController{}, "get:GetContractInfo")
38
+	beego.Router("/admin/api/contract/list", &CustomAPIController{}, "get:GetContractInfoList")
39
+	beego.Router("/admin/api/contract/edit", &CustomAPIController{}, "post:EditContractInfo")
40
+	beego.Router("/admin/api/contract/delete", &CustomAPIController{}, "post:DeleteContractInfo")
41
+	beego.Router("/admin/api/contract/check", &CustomAPIController{}, "post:CheckContractInfo")
44 42
 
45
-	beego.Router("/admin/api/followorg/list", &SystemApiController{}, "get:GetWaitFollowOrg")
46
-	beego.Router("/admin/api/unfolloworg/list", &SystemApiController{}, "get:GetAllFollowOrg")
43
+	beego.Router("/admin/api/follow/create", &CustomAPIController{}, "post:CreateFollowInfo")
44
+	beego.Router("/admin/api/follow/get", &CustomAPIController{}, "get:GetFollowInfo")
45
+	beego.Router("/admin/api/follow/list", &CustomAPIController{}, "get:GetFollowInfoList")
46
+	beego.Router("/admin/api/follow/edit", &CustomAPIController{}, "post:EditFollowInfo")
47
+	beego.Router("/admin/api/follow/delete", &CustomAPIController{}, "post:DeleteFollowInfo")
48
+	beego.Router("/admin/api/follow/check", &CustomAPIController{}, "post:CheckFollowInfo")
47 49
 
48
-	beego.Router("/admin/api/org/list", &OrgAPIController{}, "get:GetOrgListOther")
50
+	beego.Router("/admin/api/demand/create", &CustomAPIController{}, "post:CreateDemandInfo")
51
+	beego.Router("/admin/api/demand/get", &CustomAPIController{}, "get:GetDemandInfo")
52
+	beego.Router("/admin/api/demand/list", &CustomAPIController{}, "get:GetDemandInfoList")
53
+	beego.Router("/admin/api/demand/edit", &CustomAPIController{}, "post:EditDemandInfo")
54
+	beego.Router("/admin/api/demand/delete", &CustomAPIController{}, "post:DeleteDemandInfo")
55
+	beego.Router("/admin/api/demand/check", &CustomAPIController{}, "post:CheckDemandInfo")
49 56
 
50
-	beego.Router("/admin/api/activeorg/list", &OrgAPIController{}, "get:GetActiveOrgList")
51
-	beego.Router("/admin/api/newcreateorg/list", &OrgAPIController{}, "get:GetNewCreateOrgList")
52
-	beego.Router("/admin/api/newdoctornurse/list", &OrgAPIController{}, "get:GetNewDoctorNurseList")
53
-	beego.Router("/admin/api/newpatient/list", &OrgAPIController{}, "get:GetNewPatientList")
57
+	beego.Router("/admin/api/renewal/create", &CustomAPIController{}, "post:CreateRenewalInfo")
58
+	beego.Router("/admin/api/renewal/get", &CustomAPIController{}, "get:GetRenewalInfo")
59
+	beego.Router("/admin/api/renewal/list", &CustomAPIController{}, "get:GetRenewalInfoList")
60
+	beego.Router("/admin/api/renewal/edit", &CustomAPIController{}, "post:EditRenewalInfo")
61
+	beego.Router("/admin/api/renewal/delete", &CustomAPIController{}, "post:DeleteRenewalInfo")
62
+	beego.Router("/admin/api/renewal/check", &CustomAPIController{}, "post:CheckRenewalInfo")
54 63
 
55 64
 }

Datei-Diff unterdrückt, da er zu groß ist
+ 1042 - 0
controllers/admin_api_controllers/custom_api_controller.go


+ 1 - 1
controllers/admin_api_controllers/org_api_controller.go Datei anzeigen

@@ -55,7 +55,7 @@ func (this *OrgAPIController) GetOrgList() {
55 55
 		endTime = theTime.Unix()
56 56
 	}
57 57
 
58
-	list, err, total := service.GetAllOrgList(active_status, depth_active_status, startTime, endTime, province, city, district, follow, keyword, page, limit, this.GetAdminInfo().Admin.IsSuperAdmin)
58
+	list, err, total := service.GetAllOrgList(active_status, depth_active_status, startTime, endTime, province, city, district, follow, keyword, page, limit, this.GetAdminInfo().Admin.IsAdmin)
59 59
 	if err != nil {
60 60
 
61 61
 	} else {

+ 56 - 351
controllers/admin_api_controllers/system_api_controller.go Datei anzeigen

@@ -2,13 +2,9 @@ package admin_api_controllers
2 2
 
3 3
 import (
4 4
 	"XT_Admin_Api/enums"
5
-	"XT_Admin_Api/models"
6 5
 	"XT_Admin_Api/models/admin_models"
7 6
 	"XT_Admin_Api/service"
8
-	"XT_Admin_Api/utils"
9
-	"encoding/json"
10 7
 	"fmt"
11
-	"reflect"
12 8
 	"time"
13 9
 )
14 10
 
@@ -16,7 +12,23 @@ type SystemApiController struct {
16 12
 	AdminBaseAPIAuthController
17 13
 }
18 14
 
15
+//	func (this *SystemApiController) GetOrgs() {
16
+//		list, _ := service.GetAllAdmin()
17
+//		this.ServeSuccessJSON(map[string]interface{}{
18
+//			"list": list,
19
+//		})
20
+//
21
+// }
22
+func (this *SystemApiController) GetAdminUserInfo() {
23
+	id, _ := this.GetInt64("id")
24
+	admin, _ := service.FindAdminById(id)
25
+	this.ServeSuccessJSON(map[string]interface{}{
26
+		"admin": admin,
27
+	})
28
+}
29
+
19 30
 func (this *SystemApiController) GetUserList() {
31
+	fmt.Println(this.GetAdminInfo().Admin)
20 32
 	list, _ := service.GetAllAdmin()
21 33
 	this.ServeSuccessJSON(map[string]interface{}{
22 34
 		"list": list,
@@ -28,22 +40,25 @@ func (this *SystemApiController) CreateAdminUser() {
28 40
 	name := this.GetString("name")
29 41
 	mobile := this.GetString("mobile")
30 42
 	password := this.GetString("password")
43
+	role_type, _ := this.GetInt64("type")
44
+	remark := this.GetString("remark")
45
+
31 46
 	admin := &admin_models.AdminAccount{
32
-		Account:      mobile,
33
-		Pwd:          password,
34
-		Name:         name,
35
-		Status:       1,
36
-		IsSuperAdmin: 2,
37
-		Ctime:        time.Now().Unix(),
38
-		Mtime:        time.Now().Unix(),
47
+		Mobile:   mobile,
48
+		Password: password,
49
+		RoleType: role_type,
50
+		Name:     name,
51
+		Status:   1,
52
+		Remark:   remark,
53
+		IsAdmin:  2,
54
+		Ctime:    time.Now().Unix(),
55
+		Mtime:    time.Now().Unix(),
39 56
 	}
40 57
 	admins, _ := service.FindUserInfoByAccount(mobile)
41 58
 	if admins.ID > 0 {
42 59
 		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNameException)
43 60
 		return
44
-
45 61
 	}
46
-
47 62
 	err := service.CreateAdmin(admin)
48 63
 	if err == nil {
49 64
 		this.ServeSuccessJSON(map[string]interface{}{
@@ -57,22 +72,25 @@ func (this *SystemApiController) ModifyAdminUser() {
57 72
 	name := this.GetString("name")
58 73
 	mobile := this.GetString("mobile")
59 74
 	password := this.GetString("password")
60
-	status, _ := this.GetInt64("status")
75
+	role_type, _ := this.GetInt64("type")
76
+	remark := this.GetString("remark")
61 77
 
62 78
 	admins, _ := service.FindAdminById(id)
63 79
 
64 80
 	admin := &admin_models.AdminAccount{
65
-		ID:           admins.ID,
66
-		Account:      mobile,
67
-		Pwd:          password,
68
-		Name:         name,
69
-		Status:       status,
70
-		IsSuperAdmin: 2,
71
-		Ctime:        admins.Ctime,
72
-		Mtime:        time.Now().Unix(),
73
-	}
74
-
75
-	if admins.Account != mobile {
81
+		ID:       admins.ID,
82
+		Mobile:   mobile,
83
+		Password: password,
84
+		Name:     name,
85
+		Status:   1,
86
+		RoleType: role_type,
87
+		IsAdmin:  2,
88
+		Ctime:    admins.Ctime,
89
+		Remark:   remark,
90
+		Mtime:    time.Now().Unix(),
91
+	}
92
+
93
+	if admins.Mobile != mobile {
76 94
 		info, _ := service.FindUserInfoByAccount(mobile)
77 95
 		if info.ID > 0 {
78 96
 			this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeNameException)
@@ -89,345 +107,32 @@ func (this *SystemApiController) ModifyAdminUser() {
89 107
 
90 108
 func (this *SystemApiController) DeleteAdminUser() {
91 109
 	id, _ := this.GetInt64("id")
92
-	err := service.DeleteAdmin(id)
93
-	if err == nil {
94
-		this.ServeSuccessJSON(map[string]interface{}{
95
-			"msg": "删除成功",
96
-		})
97
-	}
98
-}
99
-
100
-func (this *SystemApiController) GetUserInitData() {
101
-	org, err := service.FindAllOrg()
102
-	if err == nil {
103
-		this.ServeSuccessJSON(map[string]interface{}{
104
-			"org": org,
105
-		})
106
-	}
107
-}
108
-
109
-func (this *SystemApiController) GetFollowOrg() {
110
-	id, _ := this.GetInt64("admin_user_id")
111
-	FollowOrgs, err := service.FindFollowOrg(id)
112
-	unFollow, _ := service.FindUnFollowOrgByIds(id)
113
-
114
-	fmt.Println(FollowOrgs)
115
-	fmt.Println(unFollow)
116
-
117
-	if err == nil {
118
-		this.ServeSuccessJSON(map[string]interface{}{
119
-			"follows":  FollowOrgs,
120
-			"unFollow": unFollow,
121
-		})
122
-	}
123
-}
124
-
125
-func (this *SystemApiController) GetAdminUserById() {
126
-	id, _ := this.GetInt64("id")
127
-	account, err := service.FindAdminById(id)
128
-	if err == nil {
129
-		this.ServeSuccessJSON(map[string]interface{}{
130
-			"account": account,
131
-		})
132
-	}
133
-}
134
-
135
-func (this *SystemApiController) PostFollowInfo() {
136
-	time := time.Now().Unix()
137
-
138
-	var orgFollow []*models.OrgFollow
139
-
140
-	dataBody := make(map[string]interface{}, 0)
141
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
142
-	if err != nil {
143
-		utils.ErrorLog(err.Error())
144
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
145
-		return
146
-	}
147
-
148
-	if dataBody["Follow"] != nil && reflect.TypeOf(dataBody["Follow"]).String() == "[]interface {}" {
149
-		thisFollow, _ := dataBody["Follow"].([]interface{})
150
-		if len(thisFollow) > 0 {
151
-			for _, item := range thisFollow {
152
-				items := item.(map[string]interface{})
153
-				if items["org_id"] == nil || reflect.TypeOf(items["org_id"]).String() != "float64" {
154
-					utils.ErrorLog("org_id")
155
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
156
-					return
157
-				}
158
-				org_id := int64(items["org_id"].(float64))
159
-
160
-				if items["admin_user_id"] == nil || reflect.TypeOf(items["admin_user_id"]).String() != "float64" {
161
-					utils.ErrorLog("admin_user_id")
162
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
163
-					return
164
-				}
165
-				admin_user_id := int64(items["admin_user_id"].(float64))
166
-				follow := &models.OrgFollow{
167
-					Mtime:       time,
168
-					Status:      1,
169
-					Ctime:       time,
170
-					OrgId:       org_id,
171
-					AdminUserId: admin_user_id,
172
-				}
173
-				orgFollow = append(orgFollow, follow)
174
-			}
175
-		}
176
-	}
177
-
178
-	//防止数据冗余,先查出之前被删的数据是否存在,存在则直接改变删除状态,不插入新数据
179
-	for index, follow := range orgFollow {
180
-		info, err := service.FindFollowRecordByID(follow)
181
-
182
-		if err == nil { //存在,则修改删除状态
183
-			orgFollow = append(orgFollow[:index], orgFollow[index+1:]...)
184
-			if info.Status == 0 {
185
-				follow := &models.OrgFollow{
186
-					ID:          info.ID,
187
-					Mtime:       info.Mtime,
188
-					Status:      1,
189
-					Ctime:       info.Ctime,
190
-					OrgId:       info.OrgId,
191
-					AdminUserId: info.AdminUserId,
192
-				}
193
-				service.UpdateFollow(follow)
194
-			}
195
-
196
-		}
197
-	}
198
-
199
-	if len(orgFollow) > 0 {
200
-		errs := service.CreateFollowInfo(orgFollow)
201
-		if errs == nil {
110
+	item_type, _ := this.GetInt64("type") //1.删除,2恢复
111
+	if item_type == 1 {
112
+		err := service.DeleteAdmin(id)
113
+		if err == nil {
202 114
 			this.ServeSuccessJSON(map[string]interface{}{
203
-				"msg": "提交成功",
115
+				"msg": "删除成功",
204 116
 			})
205
-
206 117
 		}
207 118
 	} else {
208
-		this.ServeSuccessJSON(map[string]interface{}{
209
-			"msg": "提交成功",
210
-		})
211
-	}
212
-
213
-}
214
-
215
-func (this *SystemApiController) CancelFollowInfo() {
216
-	time := time.Now().Unix()
217
-
218
-	var orgFollow []*models.OrgFollow
219
-
220
-	dataBody := make(map[string]interface{}, 0)
221
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
222
-	if err != nil {
223
-		utils.ErrorLog(err.Error())
224
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
225
-		return
226
-	}
227
-
228
-	if dataBody["Follow"] != nil && reflect.TypeOf(dataBody["Follow"]).String() == "[]interface {}" {
229
-		thisFollow, _ := dataBody["Follow"].([]interface{})
230
-		if len(thisFollow) > 0 {
231
-			for _, item := range thisFollow {
232
-				items := item.(map[string]interface{})
233
-				if items["org_id"] == nil || reflect.TypeOf(items["org_id"]).String() != "float64" {
234
-					utils.ErrorLog("org_id")
235
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
236
-					return
237
-				}
238
-				org_id := int64(items["org_id"].(float64))
239
-
240
-				if items["follow_id"] == nil || reflect.TypeOf(items["follow_id"]).String() != "float64" {
241
-					utils.ErrorLog("follow_id")
242
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
243
-					return
244
-				}
245
-				follow_id := int64(items["follow_id"].(float64))
246
-
247
-				if items["admin_user_id"] == nil || reflect.TypeOf(items["admin_user_id"]).String() != "float64" {
248
-					utils.ErrorLog("admin_user_id")
249
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
250
-					return
251
-				}
252
-				admin_user_id := int64(items["admin_user_id"].(float64))
253
-				follow := &models.OrgFollow{
254
-					ID:          follow_id,
255
-					Mtime:       time,
256
-					Status:      0,
257
-					Ctime:       time,
258
-					OrgId:       org_id,
259
-					AdminUserId: admin_user_id,
260
-				}
261
-				orgFollow = append(orgFollow, follow)
262
-			}
263
-		}
264
-	}
265
-	for _, follow := range orgFollow {
266
-		service.UpdateFollow(follow)
267
-	}
268
-	this.ServeSuccessJSON(map[string]interface{}{
269
-		"follow": orgFollow,
270
-	})
271
-
272
-}
273
-
274
-func (this *SystemApiController) PostUnFollow() {
275
-	org_id, _ := this.GetInt64("org_id")
276
-	admin_user_id, _ := this.GetInt64("admin_user_id")
277
-
278
-	info, _ := service.FindFollowInfoById(org_id, admin_user_id)
279
-	follow := &models.OrgFollow{
280
-		ID:          info.ID,
281
-		Mtime:       time.Now().Unix(),
282
-		Status:      0,
283
-		Ctime:       info.Ctime,
284
-		OrgId:       org_id,
285
-		AdminUserId: info.AdminUserId,
286
-	}
287
-	err := service.UpdateFollow(follow)
288
-	if err == nil {
289
-		this.ServeSuccessJSON(map[string]interface{}{
290
-			"msg": "删除成功",
291
-		})
292
-	}
293
-
294
-}
295
-
296
-func (this *SystemApiController) ModifyFollowInfo() {
297
-	time := time.Now().Unix()
298
-	var orgFollow []*models.OrgFollow
299
-	dataBody := make(map[string]interface{}, 0)
300
-	err := json.Unmarshal(this.Ctx.Input.RequestBody, &dataBody)
301
-	if err != nil {
302
-		utils.ErrorLog(err.Error())
303
-		this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
304
-		return
305
-	}
306
-
307
-	if dataBody["Follow"] != nil && reflect.TypeOf(dataBody["Follow"]).String() == "[]interface {}" {
308
-		thisFollow, _ := dataBody["Follow"].([]interface{})
309
-		if len(thisFollow) > 0 {
310
-			for _, item := range thisFollow {
311
-				items := item.(map[string]interface{})
312
-				if items["admin_user_id"] == nil || reflect.TypeOf(items["admin_user_id"]).String() != "float64" {
313
-					utils.ErrorLog("admin_user_id")
314
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
315
-					return
316
-				}
317
-				admin_user_id := int64(items["admin_user_id"].(float64))
318
-
319
-				if items["org_id"] == nil || reflect.TypeOf(items["org_id"]).String() != "float64" {
320
-					utils.ErrorLog("org_id")
321
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
322
-					return
323
-				}
324
-				org_id := int64(items["org_id"].(float64))
325
-
326
-				if items["id"] == nil || reflect.TypeOf(items["id"]).String() != "float64" {
327
-					utils.ErrorLog("id")
328
-					this.ServeFailJSONWithSGJErrorCode(enums.ErrorCodeParamWrong)
329
-					return
330
-				}
331
-				id := int64(items["id"].(float64))
332
-
333
-				if id == 0 {
334
-					follow := &models.OrgFollow{
335
-						Mtime:       time,
336
-						Status:      1,
337
-						Ctime:       time,
338
-						OrgId:       org_id,
339
-						AdminUserId: admin_user_id,
340
-					}
341
-					orgFollow = append(orgFollow, follow)
342
-				}
343
-			}
344
-		}
345
-	}
346
-	//防止数据冗余,先查出之前被删的数据是否存在,存在则直接改变删除状态,不插入新数据
347
-	for index, follow := range orgFollow {
348
-		info, err := service.FindFollowRecordByID(follow)
349
-
350
-		if err == nil { //存在,则修改删除状态
351
-			orgFollow = append(orgFollow[:index], orgFollow[index+1:]...)
352
-			if info.Status == 0 {
353
-				follow := &models.OrgFollow{
354
-					ID:          info.ID,
355
-					Mtime:       info.Mtime,
356
-					Status:      1,
357
-					Ctime:       info.Ctime,
358
-					OrgId:       info.OrgId,
359
-					AdminUserId: info.AdminUserId,
360
-				}
361
-				service.UpdateFollow(follow)
362
-			}
363
-
364
-		}
365
-	}
366
-
367
-	if len(orgFollow) > 0 {
368
-		errs := service.CreateFollowInfo(orgFollow)
369
-		if errs == nil {
119
+		err := service.UpdateAdminTwo(id)
120
+		if err == nil {
370 121
 			this.ServeSuccessJSON(map[string]interface{}{
371
-				"msg": "提交成功",
122
+				"msg": "恢复成功",
372 123
 			})
373
-
374 124
 		}
375
-	} else {
376
-		this.ServeSuccessJSON(map[string]interface{}{
377
-			"msg": "提交成功",
378
-		})
379
-	}
380
-
381
-}
382 125
 
383
-func (this *SystemApiController) GetWaitFollowOrg() {
384
-	admin_id, _ := this.GetInt64("admin_id", 0)
385
-	keyword := this.GetString("keyword")
386
-	page, _ := this.GetInt64("page", 0)
387
-	limit, _ := this.GetInt64("limit", 0)
388
-	if page <= 0 {
389
-		page = 1
390
-	}
391
-	if limit <= 0 {
392
-		limit = 7
393
-	}
394
-
395
-	list, err, total := service.GetAllWaitFollowOrgList(keyword, page, limit, admin_id)
396
-	if err != nil {
397
-
398
-	} else {
399
-		this.ServeSuccessJSON(map[string]interface{}{
400
-			"list":  list,
401
-			"total": total,
402
-		})
403 126
 	}
404 127
 
405 128
 }
406 129
 
407
-func (this *SystemApiController) GetAllFollowOrg() {
408
-	admin_id, _ := this.GetInt64("admin_id", 0)
409
-	keyword := this.GetString("keyword")
410
-	page, _ := this.GetInt64("page", 0)
411
-	limit, _ := this.GetInt64("limit", 0)
412
-	if page <= 0 {
413
-		page = 1
414
-	}
415
-	if limit <= 0 {
416
-		limit = 7
417
-	}
418
-
419
-	list, err, total := service.FindAllFollowOrg(keyword, page, limit, admin_id)
420
-	fmt.Println(list)
421
-	fmt.Println(err)
422
-	fmt.Println(total)
423
-
424
-	if err != nil {
425
-
426
-	} else {
130
+func (this *SystemApiController) GetAdminUserById() {
131
+	id, _ := this.GetInt64("id")
132
+	account, err := service.FindAdminById(id)
133
+	if err == nil {
427 134
 		this.ServeSuccessJSON(map[string]interface{}{
428
-			"list":  list,
429
-			"total": total,
135
+			"account": account,
430 136
 		})
431 137
 	}
432
-
433 138
 }

+ 11 - 9
models/admin_models/admin_models.go Datei anzeigen

@@ -3,16 +3,18 @@
3 3
 package admin_models
4 4
 
5 5
 type AdminAccount struct {
6
-	ID           int64  `gorm:"column:id" json:"id"`
7
-	Account      string `gorm:"column:account" json:"account"`
8
-	Pwd          string `gorm:"column:pwd" json:"pwd"`
9
-	Status       int64  `gorm:"column:status" json:"status"`
10
-	Ctime        int64  `gorm:"column:ctime" json:"ctime"`
11
-	Mtime        int64  `gorm:"column:mtime" json:"mtime"`
12
-	IsSuperAdmin int64  `gorm:"column:is_super_admin" json:"is_super_admin"`
13
-	Name         string `gorm:"column:name" json:"name"`
6
+	ID       int64  `gorm:"column:id" json:"id" form:"id"`
7
+	Name     string `gorm:"column:name" json:"name" form:"name"`
8
+	RoleType int64  `gorm:"column:role_type" json:"role_type" form:"role_type"`
9
+	Mobile   string `gorm:"column:mobile" json:"mobile" form:"mobile"`
10
+	Password string `gorm:"column:password" json:"password" form:"password"`
11
+	Remark   string `gorm:"column:remark" json:"remark" form:"remark"`
12
+	IsAdmin  int64  `gorm:"column:is_admin" json:"is_admin" form:"is_admin"`
13
+	Status   int64  `gorm:"column:status" json:"status" form:"status"`
14
+	Ctime    int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
15
+	Mtime    int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
14 16
 }
15 17
 
16 18
 func (AdminAccount) TableName() string {
17
-	return "sgj_admin"
19
+	return "kyy_charge_admin"
18 20
 }

+ 248 - 0
models/custom.go Datei anzeigen

@@ -0,0 +1,248 @@
1
+package models
2
+
3
+type KyyChargeCustomTwo struct {
4
+	ID                            int64  `gorm:"column:id" json:"id" form:"id"`
5
+	Name                          string `gorm:"column:name" json:"name" form:"name"`
6
+	XtOrgId                       int64  `gorm:"column:xt_org_id" json:"xt_org_id" form:"xt_org_id"`
7
+	Status                        int64  `gorm:"column:status" json:"status" form:"status"`
8
+	Ctime                         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
9
+	Mtime                         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
10
+	Creator                       int64  `gorm:"column:creator" json:"creator" form:"creator"`
11
+	Modifier                      int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
12
+	CustomType                    int64  `gorm:"column:custom_type" json:"custom_type" form:"custom_type"`
13
+	Salesperson                   string `gorm:"column:salesperson" json:"salesperson" form:"salesperson"`
14
+	SignTime                      string `gorm:"column:sign_time" json:"sign_time" form:"sign_time"`
15
+	ContractPrice                 string `gorm:"column:contract_price" json:"contract_price" form:"contract_price"`
16
+	SoftwarePrice                 string `gorm:"column:software_price" json:"software_price" form:"software_price"`
17
+	HardwarePrice                 string `gorm:"column:hardware_price" json:"hardware_price" form:"hardware_price"`
18
+	YearCostPrice                 string `gorm:"column:year_cost_price" json:"year_cost_price" form:"year_cost_price"`
19
+	Address                       string `gorm:"column:address" json:"address" form:"address"`
20
+	IsImplement                   int64  `gorm:"column:is_implement" json:"is_implement" form:"is_implement"`
21
+	LisStatus                     int64  `gorm:"column:lis_status" json:"lis_status" form:"lis_status"`
22
+	LisContact                    string `gorm:"column:lis_contact" json:"lis_contact" form:"lis_contact"`
23
+	LisTime                       string `gorm:"column:lis_time" json:"lis_time" form:"lis_time"`
24
+	LisRemark                     string `gorm:"column:lis_remark" json:"lis_remark" form:"lis_remark"`
25
+	QcStatus                      int64  `gorm:"column:qc_status" json:"qc_status" form:"qc_status"`
26
+	YbStatus                      int64  `gorm:"column:yb_status" json:"yb_status" form:"yb_status"`
27
+	Remark                        string `gorm:"column:remark" json:"remark" form:"remark"`
28
+	WeightScaleStatus             int64  `gorm:"column:weight_scale_status" json:"weight_scale_status" form:"weight_scale_status"`
29
+	WeightScaleBrand              string `gorm:"column:weight_scale_brand" json:"weight_scale_brand" form:"weight_scale_brand"`
30
+	WeightScaleRemark             string `gorm:"column:weight_scale_remark" json:"weight_scale_remark" form:"weight_scale_remark"`
31
+	SphygmomanometerStatus        int64  `gorm:"column:sphygmomanometer_status" json:"sphygmomanometer_status" form:"sphygmomanometer_status"`
32
+	SphygmomanometerBrand         string `gorm:"column:sphygmomanometer_brand" json:"sphygmomanometer_brand" form:"sphygmomanometer_brand"`
33
+	SphygmomanometerRemark        string `gorm:"column:sphygmomanometer_remark" json:"sphygmomanometer_remark" form:"sphygmomanometer_remark"`
34
+	ScannerStatus                 int64  `gorm:"column:scanner_status" json:"scanner_status" form:"scanner_status"`
35
+	ScannerBrand                  string `gorm:"column:scanner_brand" json:"scanner_brand" form:"scanner_brand"`
36
+	ScannerRemark                 string `gorm:"column:scanner_remark" json:"scanner_remark" form:"scanner_remark"`
37
+	FacialRecognitionDeviceStatus int64  `gorm:"column:facial_recognition_device_status" json:"facial_recognition_device_status" form:"facial_recognition_device_status"`
38
+	FacialRecognitionDeviceBrand  string `gorm:"column:facial_recognition_device_brand" json:"facial_recognition_device_brand" form:"facial_recognition_device_brand"`
39
+	FacialRecognitionDeviceRemark string `gorm:"column:facial_recognition_device_remark" json:"facial_recognition_device_remark" form:"facial_recognition_device_remark"`
40
+	PrinterStatus                 int64  `gorm:"column:printer_status" json:"printer_status" form:"printer_status"`
41
+	PrinterBrand                  string `gorm:"column:printer_brand" json:"printer_brand" form:"printer_brand"`
42
+	PrinterRemark                 string `gorm:"column:printer_remark" json:"printer_remark" form:"printer_remark"`
43
+	HardwareRemark                string `gorm:"column:hardware_remark" json:"hardware_remark" form:"hardware_remark"`
44
+	ImplementTime                 string `gorm:"column:implement_time" json:"implement_time" form:"implement_time"`
45
+	ImplementPerson               string `gorm:"column:implement_person" json:"implement_person" form:"implement_person"`
46
+	ImplementRemark               string `gorm:"column:implement_remark" json:"implement_remark" form:"implement_remark"`
47
+	YbTime                        string `gorm:"column:yb_time" json:"yb_time" form:"yb_time"`
48
+	YbPerson                      string `gorm:"column:yb_person" json:"yb_person" form:"yb_person"`
49
+	YbRemark                      string `gorm:"column:yb_remark" json:"yb_remark" form:"yb_remark"`
50
+	QcTime                        string `gorm:"column:qc_time" json:"qc_time" form:"qc_time"`
51
+	QcPerson                      string `gorm:"column:qc_person" json:"qc_person" form:"qc_person"`
52
+	QcRemark                      string `gorm:"column:qc_remark" json:"qc_remark" form:"qc_remark"`
53
+}
54
+
55
+func (KyyChargeCustomTwo) TableName() string {
56
+	return "kyy_charge_custom"
57
+}
58
+
59
+type KyyChargeCustom struct {
60
+	ID                            int64                         `gorm:"column:id" json:"id" form:"id"`
61
+	Name                          string                        `gorm:"column:name" json:"name" form:"name"`
62
+	XtOrgId                       int64                         `gorm:"column:xt_org_id" json:"xt_org_id" form:"xt_org_id"`
63
+	Status                        int64                         `gorm:"column:status" json:"status" form:"status"`
64
+	Ctime                         int64                         `gorm:"column:ctime" json:"ctime" form:"ctime"`
65
+	Mtime                         int64                         `gorm:"column:mtime" json:"mtime" form:"mtime"`
66
+	Creator                       int64                         `gorm:"column:creator" json:"creator" form:"creator"`
67
+	Modifier                      int64                         `gorm:"column:modifier" json:"modifier" form:"modifier"`
68
+	CustomType                    int64                         `gorm:"column:custom_type" json:"custom_type" form:"custom_type"`
69
+	Salesperson                   string                        `gorm:"column:salesperson" json:"salesperson" form:"salesperson"`
70
+	SignTime                      string                        `gorm:"column:sign_time" json:"sign_time" form:"sign_time"`
71
+	ContractPrice                 string                        `gorm:"column:contract_price" json:"contract_price" form:"contract_price"`
72
+	SoftwarePrice                 string                        `gorm:"column:software_price" json:"software_price" form:"software_price"`
73
+	HardwarePrice                 string                        `gorm:"column:hardware_price" json:"hardware_price" form:"hardware_price"`
74
+	YearCostPrice                 string                        `gorm:"column:year_cost_price" json:"year_cost_price" form:"year_cost_price"`
75
+	Address                       string                        `gorm:"column:address" json:"address" form:"address"`
76
+	IsImplement                   int64                         `gorm:"column:is_implement" json:"is_implement" form:"is_implement"`
77
+	LisStatus                     int64                         `gorm:"column:lis_status" json:"lis_status" form:"lis_status"`
78
+	LisContact                    string                        `gorm:"column:lis_contact" json:"lis_contact" form:"lis_contact"`
79
+	LisTime                       string                        `gorm:"column:lis_time" json:"lis_time" form:"lis_time"`
80
+	LisRemark                     string                        `gorm:"column:lis_remark" json:"lis_remark" form:"lis_remark"`
81
+	QcStatus                      int64                         `gorm:"column:qc_status" json:"qc_status" form:"qc_status"`
82
+	YbStatus                      int64                         `gorm:"column:yb_status" json:"yb_status" form:"yb_status"`
83
+	Remark                        string                        `gorm:"column:remark" json:"remark" form:"remark"`
84
+	WeightScaleStatus             int64                         `gorm:"column:weight_scale_status" json:"weight_scale_status" form:"weight_scale_status"`
85
+	WeightScaleBrand              string                        `gorm:"column:weight_scale_brand" json:"weight_scale_brand" form:"weight_scale_brand"`
86
+	WeightScaleRemark             string                        `gorm:"column:weight_scale_remark" json:"weight_scale_remark" form:"weight_scale_remark"`
87
+	SphygmomanometerStatus        int64                         `gorm:"column:sphygmomanometer_status" json:"sphygmomanometer_status" form:"sphygmomanometer_status"`
88
+	SphygmomanometerBrand         string                        `gorm:"column:sphygmomanometer_brand" json:"sphygmomanometer_brand" form:"sphygmomanometer_brand"`
89
+	SphygmomanometerRemark        string                        `gorm:"column:sphygmomanometer_remark" json:"sphygmomanometer_remark" form:"sphygmomanometer_remark"`
90
+	ScannerStatus                 int64                         `gorm:"column:scanner_status" json:"scanner_status" form:"scanner_status"`
91
+	ScannerBrand                  string                        `gorm:"column:scanner_brand" json:"scanner_brand" form:"scanner_brand"`
92
+	ScannerRemark                 string                        `gorm:"column:scanner_remark" json:"scanner_remark" form:"scanner_remark"`
93
+	FacialRecognitionDeviceStatus int64                         `gorm:"column:facial_recognition_device_status" json:"facial_recognition_device_status" form:"facial_recognition_device_status"`
94
+	FacialRecognitionDeviceBrand  string                        `gorm:"column:facial_recognition_device_brand" json:"facial_recognition_device_brand" form:"facial_recognition_device_brand"`
95
+	FacialRecognitionDeviceRemark string                        `gorm:"column:facial_recognition_device_remark" json:"facial_recognition_device_remark" form:"facial_recognition_device_remark"`
96
+	PrinterStatus                 int64                         `gorm:"column:printer_status" json:"printer_status" form:"printer_status"`
97
+	PrinterBrand                  string                        `gorm:"column:printer_brand" json:"printer_brand" form:"printer_brand"`
98
+	PrinterRemark                 string                        `gorm:"column:printer_remark" json:"printer_remark" form:"printer_remark"`
99
+	HardwareRemark                string                        `gorm:"column:hardware_remark" json:"hardware_remark" form:"hardware_remark"`
100
+	ImplementTime                 string                        `gorm:"column:implement_time" json:"implement_time" form:"implement_time"`
101
+	ImplementPerson               string                        `gorm:"column:implement_person" json:"implement_person" form:"implement_person"`
102
+	ImplementRemark               string                        `gorm:"column:implement_remark" json:"implement_remark" form:"implement_remark"`
103
+	YbTime                        string                        `gorm:"column:yb_time" json:"yb_time" form:"yb_time"`
104
+	YbPerson                      string                        `gorm:"column:yb_person" json:"yb_person" form:"yb_person"`
105
+	YbRemark                      string                        `gorm:"column:yb_remark" json:"yb_remark" form:"yb_remark"`
106
+	QcTime                        string                        `gorm:"column:qc_time" json:"qc_time" form:"qc_time"`
107
+	QcPerson                      string                        `gorm:"column:qc_person" json:"qc_person" form:"qc_person"`
108
+	QcRemark                      string                        `gorm:"column:qc_remark" json:"qc_remark" form:"qc_remark"`
109
+	KyyChargePaymentCollection    []*KyyChargePaymentCollection `gorm:"ForeignKey:ID;AssociationForeignKey:CustomId" json:"cpc"`
110
+	KyyChargeContact              []*KyyChargeContact           `gorm:"ForeignKey:ID;AssociationForeignKey:CustomId" json:"cc"`
111
+	KyyChargeContract             []*KyyChargeContract          `gorm:"ForeignKey:ID;AssociationForeignKey:CustomId" json:"chargeContract"`
112
+	KyyChargeDemand               []*KyyChargeDemand            `gorm:"ForeignKey:ID;AssociationForeignKey:CustomId" json:"cd"`
113
+	KyyChargeFollow               []*KyyChargeFollow            `gorm:"ForeignKey:ID;AssociationForeignKey:CustomId" json:"cf"`
114
+	KyyChargeRenewal              []*KyyChargeRenewal           `gorm:"ForeignKey:ID;AssociationForeignKey:CustomId" json:"cr"`
115
+}
116
+
117
+func (KyyChargeCustom) TableName() string {
118
+	return "kyy_charge_custom"
119
+}
120
+
121
+type KyyChargePaymentCollection struct {
122
+	ID                      int64  `gorm:"column:id" json:"id" form:"id"`
123
+	XtOrgId                 int64  `gorm:"column:xt_org_id" json:"xt_org_id" form:"xt_org_id"`
124
+	CustomId                int64  `gorm:"column:custom_id" json:"custom_id" form:"custom_id"`
125
+	CustomName              string `gorm:"column:custom_name" json:"custom_name" form:"custom_name"`
126
+	PaymentCollectionType   int64  `gorm:"column:payment_collection_type" json:"payment_collection_type" form:"payment_collection_type"`
127
+	PaymentCollectionSumamt string `gorm:"column:payment_collection_sumamt" json:"payment_collection_sumamt" form:"payment_collection_sumamt"`
128
+	SoftwareSumamt          string `gorm:"column:software_sumamt" json:"software_sumamt" form:"software_sumamt"`
129
+	HardwareSumamt          string `gorm:"column:hardware_sumamt" json:"hardware_sumamt" form:"hardware_sumamt"`
130
+	PaymentCollectionDate   string `gorm:"column:payment_collection_date" json:"payment_collection_date" form:"payment_collection_date"`
131
+	PaymentCollectionRole   string `gorm:"column:payment_collection_role" json:"payment_collection_role" form:"payment_collection_role"`
132
+	Url                     string `gorm:"column:url" json:"url" form:"url"`
133
+	Remark                  string `gorm:"column:remark" json:"remark" form:"remark"`
134
+	Ctime                   int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
135
+	Mtime                   int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
136
+	Creator                 int64  `gorm:"column:creator" json:"creator" form:"creator"`
137
+	Modifier                int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
138
+	Status                  int64  `gorm:"column:status" json:"status" form:"status"`
139
+	IsCheck                 int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
140
+}
141
+
142
+func (KyyChargePaymentCollection) TableName() string {
143
+	return "kyy_charge_payment_collection"
144
+}
145
+
146
+type KyyChargeContact struct {
147
+	ID            int64  `gorm:"column:id" json:"id" form:"id"`
148
+	XtOrgId       int64  `gorm:"column:xt_org_id" json:"xt_org_id" form:"xt_org_id"`
149
+	CustomId      int64  `gorm:"column:custom_id" json:"custom_id" form:"custom_id"`
150
+	ContactName   string `gorm:"column:contact_name" json:"contact_name" form:"contact_name"`
151
+	ContactPhone  string `gorm:"column:contact_phone" json:"contact_phone" form:"contact_phone"`
152
+	ContactDuties string `gorm:"column:contact_duties" json:"contact_duties" form:"contact_duties"`
153
+	IsDecision    string `gorm:"column:is_decision" json:"is_decision" form:"is_decision"`
154
+	Remark        string `gorm:"column:remark" json:"remark" form:"remark"`
155
+	Ctime         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
156
+	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
157
+	Creator       int64  `gorm:"column:creator" json:"creator" form:"creator"`
158
+	Modifier      int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
159
+	IsCheck       int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
160
+	Status        int64  `gorm:"column:status" json:"status" form:"status"`
161
+	ContactWay    string `gorm:"column:contact_way" json:"contact_way" form:"contact_way"`
162
+}
163
+
164
+func (KyyChargeContact) TableName() string {
165
+	return "kyy_charge_contact"
166
+}
167
+
168
+type KyyChargeContract struct {
169
+	ID            int64  `gorm:"column:id" json:"id" form:"id"`
170
+	XtOrgId       int64  `gorm:"column:xt_org_id" json:"xt_org_id" form:"xt_org_id"`
171
+	CustomId      int64  `gorm:"column:custom_id" json:"custom_id" form:"custom_id"`
172
+	Code          string `gorm:"column:code" json:"code" form:"code"`
173
+	Name          string `gorm:"column:name" json:"name" form:"name"`
174
+	CustomName    string `gorm:"column:custom_name" json:"custom_name" form:"custom_name"`
175
+	Sumamt        string `gorm:"column:sumamt" json:"sumamt" form:"sumamt"`
176
+	StartTime     string `gorm:"column:start_time" json:"start_time" form:"start_time"`
177
+	EndTime       string `gorm:"column:end_time" json:"end_time" form:"end_time"`
178
+	SigningPerson string `gorm:"column:signing_person" json:"signing_person" form:"signing_person"`
179
+	WordFileUrl   string `gorm:"column:word_file_url" json:"word_file_url" form:"word_file_url"`
180
+	PdfFileUrl    string `gorm:"column:pdf_file_url" json:"pdf_file_url" form:"pdf_file_url"`
181
+	Remark        string `gorm:"column:remark" json:"remark" form:"remark"`
182
+	Ctime         int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
183
+	Mtime         int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
184
+	Creator       int64  `gorm:"column:creator" json:"creator" form:"creator"`
185
+	Modifier      int64  `gorm:"column:modifier" json:"modifier" form:"modifier"`
186
+	IsCheck       int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
187
+	Status        int64  `gorm:"column:status" json:"status" form:"status"`
188
+}
189
+
190
+func (KyyChargeContract) TableName() string {
191
+	return "kyy_charge_contract"
192
+}
193
+
194
+type KyyChargeDemand struct {
195
+	ID               int64  `gorm:"column:id" json:"id" form:"id"`
196
+	DemandType       int64  `gorm:"column:demand_type" json:"demand_type" form:"demand_type"`
197
+	DemandDesc       string `gorm:"column:demand_desc" json:"demand_desc" form:"demand_desc"`
198
+	DemandStatus     int64  `gorm:"column:demand_status" json:"demand_status" form:"demand_status"`
199
+	DemandCreator    string `gorm:"column:demand_creator" json:"demand_creator" form:"demand_creator"`
200
+	DemandCreateDate string `gorm:"column:demand_create_date" json:"demand_create_date" form:"demand_create_date"`
201
+	DemandDirector   string `gorm:"column:demand_director" json:"demand_director" form:"demand_director"`
202
+	Ctime            int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
203
+	Mtime            int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
204
+	Status           int64  `gorm:"column:status" json:"status" form:"status"`
205
+	CustomId         int64  `gorm:"column:custom_id" json:"custom_id" form:"custom_id"`
206
+	DemandFinishDate string `gorm:"column:demand_finish_date" json:"demand_finish_date" form:"demand_finish_date"`
207
+	IsCheck          int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
208
+	DemandDetail     string `gorm:"column:demand_detail" json:"demand_detail" form:"demand_detail"`
209
+}
210
+
211
+func (KyyChargeDemand) TableName() string {
212
+	return "kyy_charge_demand"
213
+}
214
+
215
+type KyyChargeFollow struct {
216
+	ID       int64  `gorm:"column:id" json:"id" form:"id"`
217
+	Ctime    int64  `gorm:"column:ctime" json:"ctime" form:"ctime"`
218
+	Mtime    int64  `gorm:"column:mtime" json:"mtime" form:"mtime"`
219
+	Creator  int64  `gorm:"column:creator" json:"creator" form:"creator"`
220
+	CustomId int64  `gorm:"column:custom_id" json:"custom_id" form:"custom_id"`
221
+	Desc     string `gorm:"column:desc" json:"desc" form:"desc"`
222
+	Status   int64  `gorm:"column:status" json:"status" form:"status"`
223
+	IsCheck  int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
224
+}
225
+
226
+func (KyyChargeFollow) TableName() string {
227
+	return "kyy_charge_follow"
228
+}
229
+
230
+type KyyChargeRenewal struct {
231
+	ID              int64  `gorm:"column:id" json:"id" form:"id"`
232
+	Type            int64  `gorm:"column:type" json:"type" form:"type"`
233
+	StartTime       string `gorm:"column:start_time" json:"start_time" form:"start_time"`
234
+	EndTime         string `gorm:"column:end_time" json:"end_time" form:"end_time"`
235
+	SigningPersonal string `gorm:"column:signing_personal" json:"signing_personal" form:"signing_personal"`
236
+	CustomId        int64  `gorm:"column:custom_id" json:"custom_id" form:"custom_id"`
237
+	SignTime        string `gorm:"column:sign_time" json:"sign_time" form:"sign_time"`
238
+	CheckPersonal   string `gorm:"column:check_personal" json:"check_personal" form:"check_personal"`
239
+	Ctime           string `gorm:"column:ctime" json:"ctime" form:"ctime"`
240
+	Mtime           string `gorm:"column:mtime" json:"mtime" form:"mtime"`
241
+	Status          int64  `gorm:"column:status" json:"status" form:"status"`
242
+	Remark          string `gorm:"column:remark" json:"remark" form:"remark"`
243
+	IsCheck         int64  `gorm:"column:is_check" json:"is_check" form:"is_check"`
244
+}
245
+
246
+func (KyyChargeRenewal) TableName() string {
247
+	return "kyy_charge_renewal"
248
+}

+ 159 - 32
service/admin_service.go Datei anzeigen

@@ -13,7 +13,7 @@ import (
13 13
 
14 14
 func GetAdminAccount(account string, password string) (*admin_models.AdminAccount, error) {
15 15
 	var model admin_models.AdminAccount
16
-	err := readUserDb.Where("account = ? AND pwd = ? AND status = 1", account, password).First(&model).Error
16
+	err := readChargeDb.Where("mobile = ? AND password = ? AND status = 1", account, password).First(&model).Error
17 17
 	if err != nil {
18 18
 		if err == gorm.ErrRecordNotFound {
19 19
 			return nil, nil
@@ -148,32 +148,32 @@ func GetActiveOrgTotalCount() (int64, error) {
148 148
 	return int64(len(org)), nil
149 149
 }
150 150
 
151
-//获取昨天的注册机构总量
151
+// 获取昨天的注册机构总量
152 152
 func GetYesterDayRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
153 153
 	err = readUserDb.Raw("select count(id) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times  from sgj_user_org  where DATE_SUB(CURDATE(), INTERVAL 1 DAY) = date(from_unixtime(sgj_user_org.ctime)) AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1  GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
154 154
 	return
155 155
 }
156 156
 
157
-//获取近昨天的的机构活跃总量
157
+// 获取近昨天的的机构活跃总量
158 158
 func GetYesterDayActiveOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
159 159
 	db := readUserDb.Raw(" Select count(DISTINCT(org_id)) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times  from sgj_user_admin_login_log log  JOIN  (Select d.user_org_id from (Select new_role.user_org_id from  (Select count(*) as count,org_id as user_org_id from  sgj_users.sgj_user_admin_role role  where  role.`user_type` = 2 OR role.`user_type` = 3 Group by role.org_id) new_role where new_role.count > 2) d  JOIN (Select user_org_id from (Select count(*) as count,user_org_id from sgj_xt.xt_patients  where  status = 1  Group by user_org_id) new_patient where new_patient.count > 3) c On d.user_org_id = c.user_org_id) new_user_org ON new_user_org.user_org_id = log.org_id  where DATE_SUB(CURDATE(), INTERVAL 1 DAY) = date(from_unixtime(ctime))  Group by date(from_unixtime(ctime))")
160 160
 	err = db.Scan(&weekStatistics).Error
161 161
 	return
162 162
 }
163 163
 
164
-//获取昨天的的机构活跃账号总量
164
+// 获取昨天的的机构活跃账号总量
165 165
 func GetYesterDayActiveAdminUserCount() (weekStatistics []*admin_models.Statistics, err error) {
166 166
 	err = readUserDb.Raw("select count(DISTINCT(admin_user_id)) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times  from sgj_user_admin_login_log  where DATE_SUB(CURDATE(), INTERVAL 1 DAY) = date(from_unixtime(sgj_user_admin_login_log.ctime))  AND operate_type = 1 AND app_type = 3 GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
167 167
 	return
168 168
 }
169 169
 
170
-//获取昨天的的机构新增病人总量
170
+// 获取昨天的的机构新增病人总量
171 171
 func GetYesterDayNewPatientCount() (weekStatistics []*admin_models.Statistics, err error) {
172 172
 	err = readDb.Raw("select count(DISTINCT(id_card_no)) as count, DATE_FORMAT(date(from_unixtime(created_time)) ,'%Y-%m-%d') as times  from xt_patients  where DATE_SUB(CURDATE(), INTERVAL 1 DAY) = date(from_unixtime(created_time)) GROUP BY date(from_unixtime(created_time));").Scan(&weekStatistics).Error
173 173
 	return
174 174
 }
175 175
 
176
-//获取近七天每天的注册机构总量
176
+// 获取近七天每天的注册机构总量
177 177
 func GetWeekRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
178 178
 	err = readUserDb.Raw("select count(id) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times  from sgj_user_org  where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(from_unixtime(sgj_user_org.ctime)) AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1 GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
179 179
 	return
@@ -184,7 +184,7 @@ func GetWeekRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err e
184 184
 //	return
185 185
 //}
186 186
 
187
-//获取近七天每天的机构活跃总量
187
+// 获取近七天每天的机构活跃总量
188 188
 func GetWeekActiveOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
189 189
 	//db := readDb.Raw("select count(DISTINCT(user_org_id)) as count, DATE_FORMAT(date(from_unixtime(created_time)) ,'%Y-%m-%d') as times  from  xt_dialysis_order   where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(from_unixtime(created_time)) AND status = 1 GROUP BY date(from_unixtime(created_time));")
190 190
 	db := readUserDb.Raw(" Select count(DISTINCT(org_id)) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times  from sgj_user_admin_login_log log  JOIN  (Select d.user_org_id from (Select new_role.user_org_id from  (Select count(*) as count,org_id as user_org_id from  sgj_users.sgj_user_admin_role role  where  role.`user_type` = 2 OR role.`user_type` = 3 Group by role.org_id) new_role where new_role.count > 2) d  JOIN (Select user_org_id from (Select count(*) as count,user_org_id from sgj_xt.xt_patients  where  status = 1  Group by user_org_id) new_patient where new_patient.count > 3) c On d.user_org_id = c.user_org_id) new_user_org ON new_user_org.user_org_id = log.org_id  where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(from_unixtime(ctime))  Group by date(from_unixtime(ctime))")
@@ -193,142 +193,155 @@ func GetWeekActiveOrgCount() (weekStatistics []*admin_models.Statistics, err err
193 193
 	return
194 194
 }
195 195
 
196
-//获取近七天每天的机构活跃账号总量
196
+// 获取近七天每天的机构活跃账号总量
197 197
 func GetWeekActiveAdminUserCount() (weekStatistics []*admin_models.Statistics, err error) {
198 198
 	err = readUserDb.Raw("select count(DISTINCT(admin_user_id)) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times  from sgj_user_admin_login_log  where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(from_unixtime(sgj_user_admin_login_log.ctime))  AND operate_type = 1 AND app_type = 3 GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
199 199
 	return
200 200
 }
201 201
 
202
-//获取近七天每天的机构新增病人总量
202
+// 获取近七天每天的机构新增病人总量
203 203
 func GetWeekNewPatientCount() (weekStatistics []*admin_models.Statistics, err error) {
204 204
 	err = readDb.Raw("select count(DISTINCT(id_card_no)) as count, DATE_FORMAT(date(from_unixtime(created_time)) ,'%Y-%m-%d') as times  from xt_patients  where DATE_SUB(CURDATE(), INTERVAL 7 DAY) <= date(from_unixtime(created_time)) GROUP BY date(from_unixtime(created_time));").Scan(&weekStatistics).Error
205 205
 	return
206 206
 }
207 207
 
208
-//获取近30天每天的注册机构总量
208
+// 获取近30天每天的注册机构总量
209 209
 func GetMonthRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
210 210
 	err = readUserDb.Raw("select count(id) as count,DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times  from sgj_user_org  where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(from_unixtime(sgj_user_org.ctime)) AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1 GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
211 211
 	return
212 212
 }
213 213
 
214
-//获取近30天每天的机构活跃总量
214
+// 获取近30天每天的机构活跃总量
215 215
 func GetMonthActiveOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
216 216
 	err = readUserDb.Raw("Select count(DISTINCT(org_id)) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d') as times  from sgj_user_admin_login_log log  JOIN  (Select d.user_org_id from (Select new_role.user_org_id from  (Select count(*) as count,org_id as user_org_id from  sgj_users.sgj_user_admin_role role  where  role.`user_type` = 2 OR role.`user_type` = 3 Group by role.org_id) new_role where new_role.count > 2) d  JOIN (Select user_org_id from (Select count(*) as count,user_org_id from sgj_xt.xt_patients  where  status = 1  Group by user_org_id) new_patient where new_patient.count > 3) c On d.user_org_id = c.user_org_id) new_user_org ON new_user_org.user_org_id = log.org_id  where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(from_unixtime(ctime))  Group by date(from_unixtime(ctime))").Scan(&weekStatistics).Error
217 217
 	return
218 218
 }
219 219
 
220
-//获取近30天每天的机构活跃账号总量
220
+// 获取近30天每天的机构活跃账号总量
221 221
 func GetMonthActiveAdminUserCount() (weekStatistics []*admin_models.Statistics, err error) {
222 222
 	err = readUserDb.Raw("select count(DISTINCT(admin_user_id)) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m-%d')as times  from sgj_user_admin_login_log  where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(from_unixtime(sgj_user_admin_login_log.ctime)) AND sgj_user_admin_login_log.app_type = 3  AND sgj_user_admin_login_log.operate_type = 1 GROUP BY date(from_unixtime(ctime));").Scan(&weekStatistics).Error
223 223
 	return
224 224
 }
225 225
 
226
-//获取近30天每天的机构新增病人总量
226
+// 获取近30天每天的机构新增病人总量
227 227
 func GetMonthNewPatientCount() (weekStatistics []*admin_models.Statistics, err error) {
228 228
 	err = readDb.Raw("select count(DISTINCT(id_card_no)) as count, DATE_FORMAT(date(from_unixtime(created_time)) ,'%Y-%m-%d') as times  from xt_patients  where DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= date(from_unixtime(created_time)) GROUP BY date(from_unixtime(created_time));").Scan(&weekStatistics).Error
229 229
 	return
230 230
 }
231 231
 
232
-//获取近3个月每个月的注册机构总量
232
+// 获取近3个月每个月的注册机构总量
233 233
 func GetThreeMonthRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
234 234
 	err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)) ,'%Y-%m') as times,count(DISTINCT(id)) as count from sgj_user_org where  DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m') AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1 group by times").Scan(&weekStatistics).Error
235 235
 	return
236 236
 }
237 237
 
238
-//获取近3个月每个月的机构活跃账号总量
238
+// 获取近3个月每个月的机构活跃账号总量
239 239
 func GetThreeMonthActiveAdminUserCount() (weekStatistics []*admin_models.Statistics, err error) {
240 240
 	err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_admin_login_log.ctime)) ,'%Y-%m') as times,count(DISTINCT(admin_user_id)) as count from sgj_user_admin_login_log where  DATE_FORMAT(date(from_unixtime(sgj_user_admin_login_log.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m')  AND sgj_user_admin_login_log.app_type = 3  AND sgj_user_admin_login_log.operate_type = 1 group by times").Scan(&weekStatistics).Error
241 241
 	return
242 242
 }
243 243
 
244
-//获取近3个月每个月的机构活跃总量
244
+// 获取近3个月每个月的机构活跃总量
245 245
 func GetThreeMonthActiveOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
246 246
 	err = readUserDb.Raw(" Select count(DISTINCT(org_id)) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m') as times  from sgj_user_admin_login_log log  JOIN  (Select d.user_org_id from (Select new_role.user_org_id from  (Select count(*) as count,org_id as user_org_id from  sgj_users.sgj_user_admin_role role  where  role.`user_type` = 2 OR role.`user_type` = 3 Group by role.org_id) new_role where new_role.count > 2) d  JOIN (Select user_org_id from (Select count(*) as count,user_org_id from sgj_xt.xt_patients  where  status = 1  Group by user_org_id) new_patient where new_patient.count > 3) c On d.user_org_id = c.user_org_id) new_user_org ON new_user_org.user_org_id = log.org_id  where  DATE_FORMAT(date(from_unixtime(ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m') Group by times").Scan(&weekStatistics).Error
247 247
 	return
248 248
 }
249 249
 
250
-//获取近3个月每个月机构新增病人总量
250
+// 获取近3个月每个月机构新增病人总量
251 251
 func GetThreeMonthNewPatientCount() (weekStatistics []*admin_models.Statistics, err error) {
252 252
 	err = readDb.Raw("select DATE_FORMAT(date(from_unixtime(xt_patients.created_time)) ,'%Y-%m') as times,count(DISTINCT(id_card_no)) as count from xt_patients where  DATE_FORMAT(date(from_unixtime(xt_patients.created_time)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 3 month),'%Y-%m') group by times").Scan(&weekStatistics).Error
253 253
 	return
254 254
 }
255 255
 
256
-//获取近半年每个月的注册机构总量
256
+// 获取近半年每个月的注册机构总量
257 257
 func GetSixMonthRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
258 258
 	err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)) ,'%Y-%m') as times,count(DISTINCT(id)) as count from sgj_user_org where  DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m') AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1 group by times").Scan(&weekStatistics).Error
259 259
 	return
260 260
 }
261 261
 
262
-//获取近半年每个月的机构活跃账号总量
262
+// 获取近半年每个月的机构活跃账号总量
263 263
 func GetSixMonthActiveAdminUserCount() (weekStatistics []*admin_models.Statistics, err error) {
264 264
 	err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_admin_login_log.ctime)) ,'%Y-%m') as times,count(DISTINCT(admin_user_id)) as count from sgj_user_admin_login_log where  DATE_FORMAT(date(from_unixtime(sgj_user_admin_login_log.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m') AND sgj_user_admin_login_log.app_type = 3  AND sgj_user_admin_login_log.operate_type = 1 group by times").Scan(&weekStatistics).Error
265 265
 	return
266 266
 }
267 267
 
268
-//获取近半年每个月的机构活跃总量
268
+// 获取近半年每个月的机构活跃总量
269 269
 func GetSixMonthActiveOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
270 270
 	err = readUserDb.Raw(" Select count(DISTINCT(org_id)) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m') as times  from sgj_user_admin_login_log log  JOIN  (Select d.user_org_id from (Select new_role.user_org_id from  (Select count(*) as count,org_id as user_org_id from  sgj_users.sgj_user_admin_role role  where  role.`user_type` = 2 OR role.`user_type` = 3 Group by role.org_id) new_role where new_role.count > 2) d  JOIN (Select user_org_id from (Select count(*) as count,user_org_id from sgj_xt.xt_patients  where  status = 1  Group by user_org_id) new_patient where new_patient.count > 3) c On d.user_org_id = c.user_org_id) new_user_org ON new_user_org.user_org_id = log.org_id  where  DATE_FORMAT(date(from_unixtime(ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m') Group by times").Scan(&weekStatistics).Error
271 271
 	return
272 272
 }
273 273
 
274
-//获取近半年每个月机构新增病人总量
274
+// 获取近半年每个月机构新增病人总量
275 275
 func GetSixMonthNewPatientCount() (weekStatistics []*admin_models.Statistics, err error) {
276 276
 	err = readDb.Raw("select DATE_FORMAT(date(from_unixtime(xt_patients.created_time)) ,'%Y-%m') as times,count(DISTINCT(id_card_no)) as count from xt_patients where  DATE_FORMAT(date(from_unixtime(xt_patients.created_time)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 6 month),'%Y-%m') group by times").Scan(&weekStatistics).Error
277 277
 	return
278 278
 }
279 279
 
280
-//获取近1年每个月的注册机构总量
280
+// 获取近1年每个月的注册机构总量
281 281
 func GetYearRegistedOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
282 282
 	err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)) ,'%Y-%m') as times,count(DISTINCT(id)) as count from sgj_user_org where  DATE_FORMAT(date(from_unixtime(sgj_user_org.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m') AND sgj_user_org.status = 1 AND sgj_user_org.import <> 1 group by times").Scan(&weekStatistics).Error
283 283
 	return
284 284
 }
285 285
 
286
-//获取近1年每个月的机构活跃账号总量
286
+// 获取近1年每个月的机构活跃账号总量
287 287
 func GetYearActiveAdminUserCount() (weekStatistics []*admin_models.Statistics, err error) {
288 288
 	err = readUserDb.Raw("select DATE_FORMAT(date(from_unixtime(sgj_user_admin_login_log.ctime)) ,'%Y-%m') as times,count(DISTINCT(admin_user_id)) as count from sgj_user_admin_login_log where  DATE_FORMAT(date(from_unixtime(sgj_user_admin_login_log.ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m') AND sgj_user_admin_login_log.app_type = 3  AND sgj_user_admin_login_log.operate_type = 1 group by times").Scan(&weekStatistics).Error
289 289
 	return
290 290
 }
291 291
 
292
-//获取近1年每个月的机构活跃总量
292
+// 获取近1年每个月的机构活跃总量
293 293
 func GetYearActiveOrgCount() (weekStatistics []*admin_models.Statistics, err error) {
294 294
 	err = readUserDb.Raw(" Select count(DISTINCT(org_id)) as count, DATE_FORMAT(date(from_unixtime(ctime)) ,'%Y-%m') as times  from sgj_user_admin_login_log log  JOIN  (Select d.user_org_id from (Select new_role.user_org_id from  (Select count(*) as count,org_id as user_org_id from  sgj_users.sgj_user_admin_role role  where  role.`user_type` = 2 OR role.`user_type` = 3 Group by role.org_id) new_role where new_role.count > 2) d  JOIN (Select user_org_id from (Select count(*) as count,user_org_id from sgj_xt.xt_patients  where  status = 1  Group by user_org_id) new_patient where new_patient.count > 3) c On d.user_org_id = c.user_org_id) new_user_org ON new_user_org.user_org_id = log.org_id  where  DATE_FORMAT(date(from_unixtime(ctime)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m') Group by times").Scan(&weekStatistics).Error
295 295
 	return
296 296
 }
297 297
 
298
-//获取近1年每个月机构新增病人总量
298
+// 获取近1年每个月机构新增病人总量
299 299
 func GetYearNewPatientCount() (weekStatistics []*admin_models.Statistics, err error) {
300 300
 	err = readDb.Raw("select DATE_FORMAT(date(from_unixtime(xt_patients.created_time)) ,'%Y-%m') as times,count(DISTINCT(id_card_no)) as count from xt_patients where  DATE_FORMAT(date(from_unixtime(xt_patients.created_time)),'%Y-%m')>=DATE_FORMAT(date_sub(curdate(), interval 12 month),'%Y-%m') AND status > 0 group by times").Scan(&weekStatistics).Error
301 301
 	return
302 302
 }
303 303
 
304
+//func GetAllAdmin() (admin []*admin_models.AdminAccount, err error) {
305
+//	err = readChargeDb.Model(&admin_models.AdminAccount{}).Where("is_admin <> 1 AND (status = 1 OR status = 2)").Find(&admin).Error
306
+//	return
307
+//}
308
+
304 309
 func GetAllAdmin() (admin []*admin_models.AdminAccount, err error) {
305
-	err = readUserDb.Model(&admin_models.AdminAccount{}).Where("is_super_admin <> 1 AND (status = 1 OR status = 2)").Find(&admin).Error
310
+	err = readChargeDb.Model(&admin_models.AdminAccount{}).Where("is_admin <> 1 AND (status = 1 OR status = 2)").Find(&admin).Error
306 311
 	return
307 312
 }
308 313
 
309 314
 func CreateAdmin(admin *admin_models.AdminAccount) (err error) {
310
-	err = readUserDb.Model(&admin_models.AdminAccount{}).Create(&admin).Error
315
+	err = readChargeDb.Model(&admin_models.AdminAccount{}).Create(&admin).Error
311 316
 	return
312 317
 }
313 318
 
314 319
 func FindUserInfoByAccount(account string) (admin admin_models.AdminAccount, err error) {
315
-	err = readUserDb.Model(&admin_models.AdminAccount{}).Where("account = ? AND status = 1", account).First(&admin).Error
320
+	err = readChargeDb.Model(&admin_models.AdminAccount{}).Where("account = ? AND status = 1", account).First(&admin).Error
316 321
 	return
317 322
 }
318 323
 
319 324
 func FindAdminById(id int64) (admin admin_models.AdminAccount, err error) {
320
-	err = readUserDb.Model(&admin_models.AdminAccount{}).Where("id = ?", id).First(&admin).Error
325
+	err = readChargeDb.Model(&admin_models.AdminAccount{}).Where("id = ?", id).First(&admin).Error
321 326
 	return
322 327
 }
323 328
 
324 329
 func UpdateAdmin(admin *admin_models.AdminAccount) (err error) {
325
-	err = readUserDb.Model(&admin_models.AdminAccount{}).Save(&admin).Error
330
+	err = readChargeDb.Model(&admin_models.AdminAccount{}).Save(&admin).Error
326 331
 	return
327 332
 }
328 333
 
329 334
 func DeleteAdmin(id int64) (err error) {
330
-	err = readUserDb.Model(&admin_models.AdminAccount{}).Where("id = ?", id).Updates(map[string]interface{}{"status": 0}).Error
331
-	err = readUserDb.Model(&models.OrgFollow{}).Where("admin_user_id = ?", id).Updates(map[string]interface{}{"status": 0}).Error
335
+	err = readChargeDb.Model(&admin_models.AdminAccount{}).Where("id = ?", id).Updates(map[string]interface{}{"status": 0}).Error
336
+	//err = readChargeDb.Model(&models.OrgFollow{}).Where("admin_user_id = ?", id).Updates(map[string]interface{}{"status": 0}).Error
337
+
338
+	return
339
+
340
+}
341
+
342
+func UpdateAdminTwo(id int64) (err error) {
343
+	err = readChargeDb.Model(&admin_models.AdminAccount{}).Where("id = ?", id).Updates(map[string]interface{}{"status": 1}).Error
344
+	//err = readChargeDb.Model(&models.OrgFollow{}).Where("admin_user_id = ?", id).Updates(map[string]interface{}{"status": 0}).Error
332 345
 
333 346
 	return
334 347
 
@@ -485,3 +498,117 @@ func FindAllFollowOrg(keyword string, page int64, limit int64, admin_id int64) (
485 498
 	}
486 499
 
487 500
 }
501
+
502
+// 获取累积客户数
503
+func GetCustomCount() (int64, error) {
504
+	var count int64
505
+	err := readUserDb.Model(&models.KyyChargeCustom{}).Where("status = 1").Count(&count).Error
506
+	if err != nil {
507
+		return 0, err
508
+	}
509
+	return count, nil
510
+}
511
+
512
+// 本年新增收费客户
513
+func GetCurYearCustomCount() (int64, error) {
514
+	var count int64
515
+	err := readUserDb.Model(&models.KyyChargeCustom{}).Where("status = 1 and YEAR(FROM_UNIXTIME(ctime)) = YEAR(CURDATE())").Count(&count).Error
516
+	if err != nil {
517
+		return 0, err
518
+	}
519
+	return count, nil
520
+}
521
+
522
+// 统计本年新增标准版客户
523
+func GetCurYearStandCustomCount() (int64, error) {
524
+	var count int64
525
+	err := readUserDb.Model(&models.KyyChargeCustom{}).Where("status = 1 and YEAR(FROM_UNIXTIME(ctime)) = YEAR(CURDATE()) and custom_type = 1").Count(&count).Error
526
+	if err != nil {
527
+		return 0, err
528
+	}
529
+	return count, nil
530
+}
531
+
532
+// 统计本年新增尊享版客户
533
+func GetCurYearDeluxeCustomCount() (int64, error) {
534
+	var count int64
535
+	err := readUserDb.Model(&models.KyyChargeCustom{}).Where("status = 1 and YEAR(FROM_UNIXTIME(ctime)) = YEAR(CURDATE()) and custom_type = 2").Count(&count).Error
536
+	if err != nil {
537
+		return 0, err
538
+	}
539
+	return count, nil
540
+}
541
+
542
+// 统计本年新增专业版客户
543
+func GetCurYearProfessionalCustomCount() (int64, error) {
544
+	var count int64
545
+	err := readUserDb.Model(&models.KyyChargeCustom{}).Where("status = 1 and YEAR(FROM_UNIXTIME(ctime)) = YEAR(CURDATE()) and custom_type = 3").Count(&count).Error
546
+	if err != nil {
547
+		return 0, err
548
+	}
549
+	return count, nil
550
+}
551
+
552
+// 统计本年新增其他版客户
553
+func GetCurYearOtherCustomCount() (int64, error) {
554
+	var count int64
555
+	err := readUserDb.Model(&models.KyyChargeCustom{}).Where("status = 1 and YEAR(FROM_UNIXTIME(ctime)) = YEAR(CURDATE()) and custom_type = 4").Count(&count).Error
556
+	if err != nil {
557
+		return 0, err
558
+	}
559
+	return count, nil
560
+}
561
+
562
+func GetCurYearContractPriceCount() (float64, error) {
563
+	var count float64
564
+	err := readUserDb.Model(&models.KyyChargeContract{}).Select("sum(sumamt) as count").Where("status = 1 and YEAR(FROM_UNIXTIME(ctime)) = YEAR(CURDATE())").Find(&count).Error
565
+	if err != nil {
566
+		return 0, err
567
+	}
568
+	return count, nil
569
+}
570
+
571
+func GetCurYearSoftwarePriceCount() (float64, error) {
572
+	var count float64
573
+	err := readUserDb.Model(&models.KyyChargeContract{}).Select("sum(software_price) as count").Where("status = 1 and YEAR(FROM_UNIXTIME(ctime)) = YEAR(CURDATE())").Find(&count).Error
574
+	if err != nil {
575
+		return 0, err
576
+	}
577
+	return count, nil
578
+}
579
+
580
+func GetCurYearHardwarePriceCount() (float64, error) {
581
+	var count float64
582
+	err := readUserDb.Model(&models.KyyChargeContract{}).Select("sum(hardware_price) as count").Where("status = 1 and YEAR(FROM_UNIXTIME(ctime)) = YEAR(CURDATE())").Find(&count).Error
583
+	if err != nil {
584
+		return 0, err
585
+	}
586
+	return count, nil
587
+}
588
+
589
+func GetCurYearPaymentCollectionSumamtPriceCount() (float64, error) {
590
+	var count float64
591
+	err := readUserDb.Model(&models.KyyChargeContract{}).Select("sum(payment_collection_sumamt) as count").Where("status = 1 and YEAR(FROM_UNIXTIME(ctime)) = YEAR(CURDATE())").Find(&count).Error
592
+	if err != nil {
593
+		return 0, err
594
+	}
595
+	return count, nil
596
+}
597
+
598
+func GetCurYearPaymentCollectionSoftwarePriceCount() (float64, error) {
599
+	var count float64
600
+	err := readUserDb.Model(&models.KyyChargeContract{}).Select("sum(software_sumamt) as count").Where("status = 1 and YEAR(FROM_UNIXTIME(ctime)) = YEAR(CURDATE())").Find(&count).Error
601
+	if err != nil {
602
+		return 0, err
603
+	}
604
+	return count, nil
605
+}
606
+
607
+func GetCurYearPaymentCollectionHardwarePriceCount() (float64, error) {
608
+	var count float64
609
+	err := readUserDb.Model(&models.KyyChargeContract{}).Select("sum(hardware_sumamt) as count").Where("status = 1 and YEAR(FROM_UNIXTIME(ctime)) = YEAR(CURDATE())").Find(&count).Error
610
+	if err != nil {
611
+		return 0, err
612
+	}
613
+	return count, nil
614
+}

+ 130 - 0
service/custom_service.go Datei anzeigen

@@ -0,0 +1,130 @@
1
+package service
2
+
3
+import "XT_Admin_Api/models"
4
+
5
+func FindCustomInfo(org_id int64) (admin models.KyyChargeCustom, err error) {
6
+	err = ChargeReadDB().Model(&models.KyyChargeCustom{}).Where("xt_org_id = ? AND status = 1", org_id).First(&admin).Error
7
+	return
8
+}
9
+
10
+func CreateCustom(admin *models.KyyChargeCustom) (err error) {
11
+	err = ChargeWriteDB().Model(&models.KyyChargeCustom{}).Create(&admin).Error
12
+	return
13
+}
14
+
15
+func GetAllCustoms() (cus []*models.KyyChargeCustom, err error) {
16
+	err = ChargeReadDB().Model(&models.KyyChargeCustomTwo{}).Where("status = 1").Find(&cus).Error
17
+	return
18
+}
19
+
20
+func GetAllPaymentCollections() (cus []*models.KyyChargePaymentCollection, err error) {
21
+	err = ChargeReadDB().Model(&models.KyyChargePaymentCollection{}).Where("status = 1").Find(&cus).Error
22
+	return
23
+}
24
+
25
+func GetAllChargeContacts() (cus []*models.KyyChargeContact, err error) {
26
+	err = ChargeReadDB().Model(&models.KyyChargeContact{}).Where("status = 1").Find(&cus).Error
27
+	return
28
+}
29
+
30
+func GetAllChargeContracts() (cus []*models.KyyChargeContract, err error) {
31
+	err = ChargeReadDB().Model(&models.KyyChargeContract{}).Where("status = 1").Find(&cus).Error
32
+	return
33
+}
34
+
35
+func GetAllChargeDemand() (cus []*models.KyyChargeDemand, err error) {
36
+	err = ChargeReadDB().Model(&models.KyyChargeDemand{}).Where("status = 1").Find(&cus).Error
37
+	return
38
+}
39
+
40
+func GetAllChargeFollow() (cus []*models.KyyChargeFollow, err error) {
41
+	err = ChargeReadDB().Model(&models.KyyChargeFollow{}).Where("status = 1").Find(&cus).Error
42
+	return
43
+}
44
+
45
+func GetAllChargeRenewal() (cus []*models.KyyChargeRenewal, err error) {
46
+	err = ChargeReadDB().Model(&models.KyyChargeRenewal{}).Where("status = 1").Find(&cus).Error
47
+	return
48
+}
49
+
50
+func FindCustomInfoByID(id int64) (admin models.KyyChargeCustom, err error) {
51
+	err = ChargeReadDB().Model(&models.KyyChargeCustom{}).
52
+		Preload("KyyChargePaymentCollection", "status = 1").
53
+		Preload("KyyChargeContact", "status = 1").
54
+		Preload("KyyChargeContract", "status = 1").
55
+		Preload("KyyChargeDemand", "status = 1").
56
+		Preload("KyyChargeFollow", "status = 1").
57
+		Preload("KyyChargeRenewal", "status = 1").
58
+		Where("id = ? AND status = 1", id).First(&admin).Error
59
+	return
60
+}
61
+
62
+func UpdateCustom(custom models.KyyChargeCustom) (err error) {
63
+	err = ChargeWriteDB().Save(custom).Error
64
+	return
65
+}
66
+
67
+func CreateChargePaymentCollection(cpc *models.KyyChargePaymentCollection) (err error) {
68
+	err = ChargeWriteDB().Save(cpc).Error
69
+	return
70
+}
71
+
72
+func SaveChargePaymentCollection(cpc *models.KyyChargePaymentCollection) (err error) {
73
+	err = ChargeWriteDB().Save(cpc).Error
74
+	return
75
+}
76
+
77
+func FindPaymentCollectionInfo(id int64) (cpc models.KyyChargePaymentCollection, err error) {
78
+	err = ChargeReadDB().Model(&models.KyyChargePaymentCollection{}).Where("id = ? AND status = 1", id).First(&cpc).Error
79
+	return
80
+}
81
+
82
+func SaveChargeContact(chargeContact *models.KyyChargeContact) (err error) {
83
+	err = ChargeWriteDB().Save(chargeContact).Error
84
+	return
85
+}
86
+
87
+func FindChargeContactInfo(id int64) (cpc models.KyyChargeContact, err error) {
88
+	err = ChargeReadDB().Model(&models.KyyChargeContact{}).Where("id = ? AND status = 1", id).First(&cpc).Error
89
+	return
90
+}
91
+
92
+func SaveChargeContract(chargeContract *models.KyyChargeContract) (err error) {
93
+	err = ChargeWriteDB().Save(chargeContract).Error
94
+	return
95
+}
96
+
97
+func FindChargeContractInfo(id int64) (cpc models.KyyChargeContract, err error) {
98
+	err = ChargeReadDB().Model(&models.KyyChargeContract{}).Where("id = ? AND status = 1", id).First(&cpc).Error
99
+	return
100
+}
101
+
102
+func SaveChargeFollow(chargeFollow *models.KyyChargeFollow) (err error) {
103
+	err = ChargeWriteDB().Save(chargeFollow).Error
104
+	return
105
+}
106
+
107
+func FindChargeFollowInfo(id int64) (cf models.KyyChargeFollow, err error) {
108
+	err = ChargeReadDB().Model(&models.KyyChargeFollow{}).Where("id = ? AND status = 1", id).First(&cf).Error
109
+	return
110
+}
111
+
112
+func SaveChargeDemand(cd *models.KyyChargeDemand) (err error) {
113
+	err = ChargeWriteDB().Save(cd).Error
114
+	return
115
+}
116
+
117
+func FindChargeDemandInfo(id int64) (cd models.KyyChargeDemand, err error) {
118
+	err = ChargeReadDB().Model(&models.KyyChargeDemand{}).Where("id = ? AND status = 1", id).First(&cd).Error
119
+	return
120
+}
121
+
122
+func SaveChargeRenewal(chargeRenewal *models.KyyChargeRenewal) (err error) {
123
+	err = ChargeWriteDB().Save(chargeRenewal).Error
124
+	return
125
+}
126
+
127
+func FindChargeRenewalInfo(id int64) (chargeRenewal models.KyyChargeRenewal, err error) {
128
+	err = ChargeReadDB().Model(&models.KyyChargeRenewal{}).Where("id = ? AND status = 1", id).First(&chargeRenewal).Error
129
+	return
130
+}

+ 43 - 0
service/db.go Datei anzeigen

@@ -29,6 +29,9 @@ var writeDb *gorm.DB
29 29
 var readUserDb *gorm.DB
30 30
 var writeUserDb *gorm.DB
31 31
 
32
+var readChargeDb *gorm.DB
33
+var writeChargeDb *gorm.DB
34
+
32 35
 var err error
33 36
 
34 37
 func ConnectDB() {
@@ -56,12 +59,27 @@ func ConnectDB() {
56 59
 	writeUserPass := beego.AppConfig.String("writeuserpass")
57 60
 	writeUserName := beego.AppConfig.String("writeusername")
58 61
 
62
+	readChargeHost := beego.AppConfig.String("readchargehost")
63
+	readChargePort := beego.AppConfig.String("readchargeport")
64
+	readChargeUser := beego.AppConfig.String("readchargeuser")
65
+	readChargePass := beego.AppConfig.String("readchargepass")
66
+	readChargeName := beego.AppConfig.String("readchargename")
67
+
68
+	writeChargeHost := beego.AppConfig.String("writechargehost")
69
+	writeChargePort := beego.AppConfig.String("writechargeport")
70
+	writeChargeUser := beego.AppConfig.String("writechargeuser")
71
+	writeChargePass := beego.AppConfig.String("writechargepass")
72
+	writeChargeName := beego.AppConfig.String("writechargename")
73
+
59 74
 	rdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUser, readPass, readHost, readPort, readName)
60 75
 	wdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUser, writePass, writeHost, writePort, writeName)
61 76
 
62 77
 	rudsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readUserUser, readUserPass, readUserHost, readUserPort, readUserName)
63 78
 	wudsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeUserUser, writeUserPass, writeUserHost, writeUserPort, writeUserName)
64 79
 
80
+	rcdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", readChargeUser, readChargePass, readChargeHost, readChargePort, readChargeName)
81
+	wcdsn := fmt.Sprintf("%s:%s@tcp(%s:%s)/%s?charset=utf8mb4&parseTime=true", writeChargeUser, writeChargePass, writeChargeHost, writeChargePort, writeChargeName)
82
+
65 83
 	readDb, err = gorm.Open("mysql", rdsn)
66 84
 
67 85
 	//defer readDb.Close()
@@ -104,6 +122,24 @@ func ConnectDB() {
104 122
 	writeUserDb.DB().SetMaxOpenConns(20)
105 123
 	writeUserDb.LogMode(true)
106 124
 
125
+	readChargeDb, err = gorm.Open("mysql", rcdsn)
126
+	if err != nil {
127
+		//beego.Error(err)
128
+	}
129
+
130
+	readChargeDb.DB().SetMaxIdleConns(5)
131
+	readChargeDb.DB().SetMaxOpenConns(20)
132
+	readChargeDb.LogMode(true)
133
+
134
+	writeChargeDb, err = gorm.Open("mysql", wcdsn)
135
+	if err != nil {
136
+		//beego.Error(err)
137
+	}
138
+	//defer writeUserDb.Close()
139
+	writeChargeDb.DB().SetMaxIdleConns(5)
140
+	writeChargeDb.DB().SetMaxOpenConns(20)
141
+	writeChargeDb.LogMode(true)
142
+
107 143
 }
108 144
 
109 145
 func XTReadDB() *gorm.DB {
@@ -118,3 +154,10 @@ func UserReadDB() *gorm.DB {
118 154
 func UserWriteDB() *gorm.DB {
119 155
 	return writeUserDb
120 156
 }
157
+
158
+func ChargeReadDB() *gorm.DB {
159
+	return readChargeDb
160
+}
161
+func ChargeWriteDB() *gorm.DB {
162
+	return writeChargeDb
163
+}

+ 21 - 21
service/function_service.go Datei anzeigen

@@ -5,11 +5,11 @@ import (
5 5
 	"XT_Admin_Api/models/function_models"
6 6
 )
7 7
 
8
-//病人管理
8
+// 病人管理
9 9
 func GetTodayInfo(to int64, ctime int64, page int64, limit int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
10 10
 
11 11
 	//offset := (page - 1) * limit
12
-	if admin.IsSuperAdmin == 1 {
12
+	if admin.IsAdmin == 1 {
13 13
 		err = readUserDb.Raw("select *, a.name as admin_name,  d.namepath as namepath   from sgj_users.sgj_user_org as u left join sgj_org_follow as f On f.org_id = u.id AND f.status = 1  left JOIN sgj_user_district as d On d.id = u.city left JoIN sgj_admin as a On a.id = f.admin_user_id AND  a.status = 1 left join sgj_xt.xt_patients as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ? AND u.import <> 1   GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
14 14
 	} else {
15 15
 		err = readUserDb.Raw("select *, a.name as admin_name, d.namepath as namepath  from sgj_users.sgj_user_org as u  join sgj_org_follow as f On f.org_id = u.id AND f.status = 1 AND f.admin_user_id = ? left JoIN sgj_admin as a On a.id = f.admin_user_id AND a.status = 1  left JOIN sgj_user_district as d On d.id = u.city left join sgj_xt.xt_patients as x on x.user_org_id = u.id where x.created_time >= ? AND x.created_time <= ? AND u.import <> 1   GROUP BY x.user_org_id", admin.ID, to, ctime).Scan(&patientinfo).Error
@@ -24,12 +24,12 @@ func GetTodayInfo(to int64, ctime int64, page int64, limit int64, admin *admin_m
24 24
 	return patientinfo, total, err
25 25
 }
26 26
 
27
-//透析处方
27
+// 透析处方
28 28
 func GetTodayDialysisPatientsInfo(to int64, ctime int64, page int64, limit int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
29 29
 
30 30
 	//offset := (page - 1) * limit
31 31
 
32
-	if admin.IsSuperAdmin == 1 {
32
+	if admin.IsAdmin == 1 {
33 33
 		err = readUserDb.Raw("select * , a.name as admin_name,  d.namepath as namepath  from sgj_users.sgj_user_org as u left JOIN sgj_user_district as d On d.id = u.city left join sgj_org_follow as f On f.org_id = u.id AND f.status = 1  left JoIN sgj_admin as a On a.id = f.admin_user_id AND a.status = 1 left join sgj_xt.xt_dialysis_prescription as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? AND u.import <> 1  GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
34 34
 
35 35
 	} else {
@@ -47,11 +47,11 @@ func GetTodayDialysisPatientsInfo(to int64, ctime int64, page int64, limit int64
47 47
 	return patientinfo, total, err
48 48
 }
49 49
 
50
-//接诊评估
50
+// 接诊评估
51 51
 func GetTodayReceivePatientsInfo(to int64, ctime int64, page int64, limit int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
52 52
 
53 53
 	//offset := (page - 1) * limit
54
-	if admin.IsSuperAdmin == 1 {
54
+	if admin.IsAdmin == 1 {
55 55
 		err = readUserDb.Raw("select *, a.name as admin_name,  d.namepath as namepath  from sgj_users.sgj_user_org as u left JOIN sgj_user_district as d On d.id = u.city  left join sgj_org_follow as f On f.org_id = u.id  AND f.status = 1 left JoIN sgj_admin as a On a.id = f.admin_user_id AND a.status = 1 left join sgj_xt.xt_receive_treatment_asses as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? AND u.import <> 1  GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
56 56
 
57 57
 	} else {
@@ -72,7 +72,7 @@ func GetTodayReceivePatientsInfo(to int64, ctime int64, page int64, limit int64,
72 72
 // 透前评估
73 73
 func GetTodayBeforDislysisInfo(to int64, ctime int64, page int64, limit int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
74 74
 	//offset := (page - 1) * limit
75
-	if admin.IsSuperAdmin == 1 {
75
+	if admin.IsAdmin == 1 {
76 76
 		err = readUserDb.Raw("select *, a.name as admin_name,  d.namepath as namepath  from sgj_users.sgj_user_org as u left JOIN sgj_user_district as d On d.id = u.city left join sgj_org_follow as f On f.org_id = u.id left AND f.status = 1  JoIN sgj_admin as a On a.id = f.admin_user_id AND a.status = 1 left join sgj_xt.xt_assessment_before_dislysis as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? AND u.import <> 1  GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
77 77
 
78 78
 	} else {
@@ -91,12 +91,12 @@ func GetTodayBeforDislysisInfo(to int64, ctime int64, page int64, limit int64, a
91 91
 	return patientinfo, total, err
92 92
 }
93 93
 
94
-//零食医嘱
94
+// 零食医嘱
95 95
 func GetTodayDoctorsOrderInfo(to int64, ctime int64, page int64, limit int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
96 96
 
97 97
 	//offset := (page - 1) * limit
98 98
 
99
-	if admin.IsSuperAdmin == 1 {
99
+	if admin.IsAdmin == 1 {
100 100
 
101 101
 		err = readUserDb.Raw("select *, a.name as admin_name,  d.namepath as namepath  from sgj_users.sgj_user_org as u left JOIN sgj_user_district as d On d.id = u.city left join sgj_org_follow as f On f.org_id = u.id  AND f.status = 1 left JoIN sgj_admin as a On a.id = f.admin_user_id  AND a.status = 1 join sgj_xt.xt_doctor_advice as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ?  AND u.import <> 1 GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
102 102
 
@@ -115,11 +115,11 @@ func GetTodayDoctorsOrderInfo(to int64, ctime int64, page int64, limit int64, ad
115 115
 	return patientinfo, total, err
116 116
 }
117 117
 
118
-//双人核对
118
+// 双人核对
119 119
 func GetTodayDoubleCheckInfo(to int64, ctime int64, page int64, limit int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
120 120
 
121 121
 	//offset := (page - 1) * limit
122
-	if admin.IsSuperAdmin == 1 {
122
+	if admin.IsAdmin == 1 {
123 123
 		err = readUserDb.Raw("select *, a.name as admin_name,  d.namepath as namepath  from sgj_users.sgj_user_org as u left JOIN sgj_user_district as d On d.id = u.city left join sgj_org_follow as f On f.org_id = u.id AND f.status = 1  left JoIN sgj_admin as a On a.id = f.admin_user_id AND a.status = 1 join sgj_xt.xt_double_check as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? AND u.import <> 1  GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
124 124
 
125 125
 	} else {
@@ -137,11 +137,11 @@ func GetTodayDoubleCheckInfo(to int64, ctime int64, page int64, limit int64, adm
137 137
 	return patientinfo, total, err
138 138
 }
139 139
 
140
-//透析上机
140
+// 透析上机
141 141
 func GetTodayDialysisMachinek(to int64, ctime int64, page int64, limit int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
142 142
 
143 143
 	//offset := (page - 1) * limit
144
-	if admin.IsSuperAdmin == 1 {
144
+	if admin.IsAdmin == 1 {
145 145
 		err = readUserDb.Raw("select *, a.name as admin_name,  d.namepath as namepath  from sgj_users.sgj_user_org as u left JOIN sgj_user_district as d On d.id = u.city left join sgj_org_follow as f On f.org_id = u.id  AND f.status = 1  left JoIN sgj_admin as a On a.id = f.admin_user_id AND a.status = 1 left join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? AND u.import <> 1  GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
146 146
 
147 147
 	} else {
@@ -160,11 +160,11 @@ func GetTodayDialysisMachinek(to int64, ctime int64, page int64, limit int64, ad
160 160
 	return patientinfo, total, err
161 161
 }
162 162
 
163
-//透析检测
163
+// 透析检测
164 164
 func GetTodayDialysisExamination(to int64, ctime int64, page int64, limit int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
165 165
 
166 166
 	//offset := (page - 1) * limit
167
-	if admin.IsSuperAdmin == 1 {
167
+	if admin.IsAdmin == 1 {
168 168
 		err = readUserDb.Raw("select *, a.name as admin_name,  d.namepath as namepath  from sgj_users.sgj_user_org as u left JOIN sgj_user_district as d On d.id = u.city left join sgj_org_follow as f On f.org_id = u.id AND f.status = 1  left JoIN sgj_admin as a On a.id = f.admin_user_id AND a.status = 1 join sgj_xt.xt_monitoring_record as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? AND u.import <> 1  GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
169 169
 
170 170
 	} else {
@@ -181,11 +181,11 @@ func GetTodayDialysisExamination(to int64, ctime int64, page int64, limit int64,
181 181
 	return patientinfo, total, err
182 182
 }
183 183
 
184
-//透析下机
184
+// 透析下机
185 185
 func GetTodayBeforOrpenetration(to int64, ctime int64, page int64, limit int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
186 186
 
187 187
 	//offset := (page - 1) * limit
188
-	if admin.IsSuperAdmin == 1 {
188
+	if admin.IsAdmin == 1 {
189 189
 		err = readUserDb.Raw("select *, a.name as admin_name,  d.namepath as namepath  from sgj_users.sgj_user_org as u left JOIN sgj_user_district as d On d.id = u.city left join sgj_org_follow as f On f.org_id = u.id AND f.status = 1  left JoIN sgj_admin as a On a.id = f.admin_user_id AND a.status = 1 join sgj_xt.xt_dialysis_order as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? AND u.import <> 1  GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
190 190
 
191 191
 	} else {
@@ -202,10 +202,10 @@ func GetTodayBeforOrpenetration(to int64, ctime int64, page int64, limit int64,
202 202
 	return patientinfo, total, err
203 203
 }
204 204
 
205
-//透后评估
205
+// 透后评估
206 206
 func GetTodayPostAssessment(to int64, ctime int64, page int64, limit int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
207 207
 	//offset := (page - 1) * limit
208
-	if admin.IsSuperAdmin == 1 {
208
+	if admin.IsAdmin == 1 {
209 209
 		err = readUserDb.Raw("select *, a.name as admin_name,  d.namepath as namepath  from sgj_users.sgj_user_org as u left JOIN sgj_user_district as d On d.id = u.city left join sgj_org_follow as f On f.org_id = u.id  AND f.status = 1  left JoIN sgj_admin as a On a.id = f.admin_user_id AND a.status = 1 join sgj_xt.xt_assessment_after_dislysis as x on x.user_org_id = u.id left JOIN sgj_xt.xt_patients as p On p.id = x.patient_id  where x.created_time >= ? AND x.created_time <= ? AND u.import <> 1  GROUP BY x.user_org_id", to, ctime).Scan(&patientinfo).Error
210 210
 
211 211
 	} else {
@@ -225,7 +225,7 @@ func GetTodayPostAssessment(to int64, ctime int64, page int64, limit int64, admi
225 225
 
226 226
 func GetTodayEntrylist(to int64, ctime int64, limit int64, page int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
227 227
 	//offset := (page - 1) * limit
228
-	if admin.IsSuperAdmin == 1 {
228
+	if admin.IsAdmin == 1 {
229 229
 		err = readUserDb.Raw("select *, a.name as admin_name,  d.namepath as namepath  from sgj_users.sgj_user_org as u left JOIN sgj_user_district as d On d.id = u.city  join sgj_xt.xt_warehouse as x on x.org_id = u.id   LEFT JOIN  sgj_users.sgj_org_follow as f ON f.org_id = u.id AND f.status = 1   LEFT JOIN   sgj_users.sgj_admin as a on a.id = f.admin_user_id AND a.status = 1  where x.ctime >= ? AND x.ctime<= ? AND u.import <> 1  GROUP BY x.org_id", to, ctime).Scan(&patientinfo).Error
230 230
 
231 231
 	} else {
@@ -245,7 +245,7 @@ func GetTodayEntrylist(to int64, ctime int64, limit int64, page int64, admin *ad
245 245
 
246 246
 func GetTodayExitlist(to int64, ctime int64, limit int64, page int64, admin *admin_models.AdminAccount) (patientinfo []function_models.PatientInfo, total int64, err error) {
247 247
 	//offset := (page - 1) * limit
248
-	if admin.IsSuperAdmin == 1 {
248
+	if admin.IsAdmin == 1 {
249 249
 		err = readUserDb.Raw("select *, a.name as admin_name,  d.namepath as namepath  from sgj_users.sgj_user_org as u  left JOIN sgj_user_district as d On d.id = u.city join sgj_xt.xt_warehouse_out as x on x.org_id = u.id  LEFT JOIN  sgj_users.sgj_org_follow as f ON f.org_id = u.id  AND f.status = 1  LEFT JOIN   sgj_users.sgj_admin as a on a.id = f.admin_user_id AND a.status = 1   where x.ctime >= ? AND x.ctime<= ? AND u.import <> 1  GROUP BY x.org_id", to, ctime).Scan(&patientinfo).Error
250 250
 
251 251
 	} else {