|
|
@@ -1,16 +1,22 @@
|
|
|
package casbin
|
|
|
|
|
|
import (
|
|
|
- "dashoo.cn/backend/api/business/organize"
|
|
|
- "dashoo.cn/business2/userRole"
|
|
|
- "dashoo.cn/business2/permission"
|
|
|
- "dashoo.cn/backend/api/models"
|
|
|
"encoding/json"
|
|
|
"strings"
|
|
|
|
|
|
+ "dashoo.cn/backend/api/business/equipment"
|
|
|
+ "dashoo.cn/backend/api/business/flupplan"
|
|
|
+ "dashoo.cn/backend/api/business/organize"
|
|
|
+ "dashoo.cn/backend/api/business/role"
|
|
|
+ "dashoo.cn/backend/api/business/samplesapply"
|
|
|
+ "dashoo.cn/backend/api/business/samplesfileinfo"
|
|
|
+ "dashoo.cn/backend/api/business/samplesinfo"
|
|
|
+ "dashoo.cn/backend/api/models"
|
|
|
+ "dashoo.cn/business2/permission"
|
|
|
+ "dashoo.cn/business2/userRole"
|
|
|
+
|
|
|
. "dashoo.cn/backend/api/controllers"
|
|
|
"dashoo.cn/utils"
|
|
|
-
|
|
|
)
|
|
|
|
|
|
// Operations about Users
|
|
|
@@ -34,6 +40,11 @@ type UserModel struct {
|
|
|
Sign string `json:"sign"`
|
|
|
}
|
|
|
|
|
|
+type UserModuleModel struct {
|
|
|
+ A1list string `json:"a1"` // 第一级菜单
|
|
|
+ A2list string `json:"a2"` // 第二级菜单
|
|
|
+}
|
|
|
+
|
|
|
// @Title get
|
|
|
// @Description get user by token
|
|
|
// @Param uid path string true "The key for staticblock"
|
|
|
@@ -43,6 +54,7 @@ type UserModel struct {
|
|
|
func (this *UserController) Get() {
|
|
|
svc := userRole.GetUserService(utils.DBE)
|
|
|
usermodel := svc.GetUserInfoSelf(this.User.Username)
|
|
|
+
|
|
|
// var companyentity company.Base_Company
|
|
|
// svc.GetEntityById(usermodel.AccCode, &companyentity)
|
|
|
var user models.User
|
|
|
@@ -60,8 +72,7 @@ func (this *UserController) Get() {
|
|
|
user.Profile.AccCode = usermodel.AccCode
|
|
|
user.Profile.DepartmentId = usermodel.Departmentid
|
|
|
user.Profile.Id = usermodel.Id
|
|
|
- // todo 从this.User获取用户名,再查询出具体用户
|
|
|
- // user := models.User{"user01", "张三", models.Profile{Gender: "male", Age: 20, Address: "china", Email: "123zs@gmail.com", Realname: "ppppppp"}}
|
|
|
+
|
|
|
this.Data["json"] = user
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
@@ -70,14 +81,14 @@ func (this *UserController) Get() {
|
|
|
// @Description 获取用户菜单权限
|
|
|
// @Success 200 {object} controllers.Request
|
|
|
// @router /getusermodule [get]
|
|
|
-func (this *UserController) GetUserModule() {
|
|
|
- //svc := permission.GetPermissionService(utils.DBE)
|
|
|
- //var model UserModuleModel
|
|
|
- //model.A1list = svc.GetModuleAllNamesByCode(this.User.Id, "A1")
|
|
|
- //model.A2list = svc.GetModuleAllNamesByCode(this.User.Id, "A2")
|
|
|
- //this.Data["json"] = model
|
|
|
- //this.ServeJSON()
|
|
|
-}
|
|
|
+//func (this *UserController) GetUserModule() {
|
|
|
+// svc := permission.GetPermissionService(utils.DBE)
|
|
|
+// var model UserModuleModel
|
|
|
+// model.A1list = svc.GetModuleAllNamesByCode(this.User.Id, "A1")
|
|
|
+// model.A2list = svc.GetModuleAllNamesByCode(this.User.Id, "A2")
|
|
|
+// this.Data["json"] = model
|
|
|
+// this.ServeJSON()
|
|
|
+//}
|
|
|
|
|
|
// @Title 获取用户菜单权限
|
|
|
// @Description 获取用户菜单权限
|
|
|
@@ -164,6 +175,7 @@ func (this *UserController) UserPowerPostRole() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
// @Title 创建用户
|
|
|
// @Description 创建用户
|
|
|
// @Param body body business.device.DeviceChannels "传感器信息"
|
|
|
@@ -351,3 +363,97 @@ func (this *UserController) Delete() {
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+//############获取账户信息
|
|
|
+type AccountTjModel struct {
|
|
|
+ DeviceTotal int64
|
|
|
+ YILRTotal int64
|
|
|
+ YULRTotal int64
|
|
|
+ DFCTotal int64
|
|
|
+ YGDTotal int64
|
|
|
+ SFTotal int64
|
|
|
+ RKTotal int64
|
|
|
+ RKlist []samplesapply.SamplesApply
|
|
|
+ CKTotal int64
|
|
|
+ CKlist []samplesapply.SamplesApply
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 获取账户统计信息
|
|
|
+// @Description 获取账户统计信息
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /getaccountinfo [get]
|
|
|
+func (this *UserController) GetAccountInfo() {
|
|
|
+ svcs := equipment.GetEquipmentService(utils.DBE)
|
|
|
+ svcrole := role.GetRoleService(utils.DBE)
|
|
|
+ roleids := svcrole.GetRoleidsByuid(utils.ToStr(this.User.Id))
|
|
|
+ where := " a.AccCode = '" + this.User.AccCode + "'"
|
|
|
+ where = where + " and (a.CreateUserId=" + utils.ToStr(this.User.Id) + " or a.Id in (select EquipmentId Id FROM Base_RoleEquipment where RoleId in (" + strings.Join(roleids, ",") + ")))"
|
|
|
+
|
|
|
+ devicetotal, _ := svcs.GetEquipmenViewtList(1, 1, "a.Id", where)
|
|
|
+
|
|
|
+ //已录入样本
|
|
|
+ where1 := " IState =1 and DeletionStateCode=0 "
|
|
|
+
|
|
|
+ poweeids := svcs.GetPowerEquipmentids(this.User.AccCode, utils.ToStr(this.User.Id))
|
|
|
+ where1 = where1 + " and a.EquipmentId in(" + strings.Join(poweeids, ",") + ")"
|
|
|
+ svc := samplesinfo.GetSamplesInfoService(utils.DBE)
|
|
|
+ yilurutotal, _ := svc.GetPagingEntitiesWithOrderSearch(this.User.AccCode, 1, 1, "Id desc", where1)
|
|
|
+ // 预录入
|
|
|
+ where2 := " a.IState in (2,3,4,7,8) and a.DeletionStateCode=0 "
|
|
|
+ yulurutotal, _ := svc.GetPagingEntitiesWithOrderSearch(this.User.AccCode, 1, 1, "Id desc", where2)
|
|
|
+
|
|
|
+ //待复存
|
|
|
+ where3 := " DeletionStateCode=0 and (IState=6 or ( IState=5 and a.EquipmentId in(" + strings.Join(poweeids, ",") + ")))"
|
|
|
+ daifuchuntotal, _ := svc.GetPagingEntitiesWithOrderSearch(this.User.AccCode, 1, 1, "Id desc", where3)
|
|
|
+
|
|
|
+ //已归档
|
|
|
+ svcf := samplesfileinfo.GetSamplesFileInfoService(utils.DBE)
|
|
|
+ where4 := " DeletionStateCode=0 "
|
|
|
+ yiguidangtotal, _ := svcf.GetPagingEntitiesWithOrderSearch(this.User.AccCode, 1, 1, "Id desc", where4)
|
|
|
+
|
|
|
+ //待办事项
|
|
|
+ svcw := samplesapply.GetSamplesApplyService(utils.DBE)
|
|
|
+ where_rk := " ApplyType = 1 and ApplyStatus = 0 "
|
|
|
+ rktotal, rklist := svcw.GetApplyViewtList(1, 1, this.User.AccCode+SamplesApplyName, "Id", where_rk)
|
|
|
+ where_ck := " ApplyType = 2 and ApplyStatus = 0 "
|
|
|
+ cktotal, cklist := svcw.GetApplyViewtList(1, 1, this.User.AccCode+SamplesApplyName, "Id", where_ck)
|
|
|
+
|
|
|
+ //待随访
|
|
|
+ svcsf := flupplan.GetFlupPlanService(utils.DBE)
|
|
|
+ where_sf := " a.AccCode='" + this.User.AccCode + "' and a.DeletionStateCode=0 "
|
|
|
+ sftotal, _ := svcsf.GetPagingEntitiesWithOrderSearch(1, 1, "a.Id desc", where_sf, this.User.AccCode+DonorstbName)
|
|
|
+
|
|
|
+ this.Data["json"] = AccountTjModel{devicetotal, yilurutotal, yulurutotal, daifuchuntotal, yiguidangtotal, sftotal, rktotal, rklist, cktotal, cklist}
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 按样本类型统计样本数量
|
|
|
+// @Description 按样本类型统计样本数量
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /totalbysampletype [get]
|
|
|
+func (this *UserController) GetTotalByGroupbysampletype() {
|
|
|
+ diseases := this.GetString("diseases")
|
|
|
+ svc := samplesinfo.GetSamplesInfoService(utils.DBE)
|
|
|
+ where := " a.DeletionStateCode=0 "
|
|
|
+ if diseases != "" {
|
|
|
+ where = where + " and c.PathologicalNum = '" + diseases + "'"
|
|
|
+ }
|
|
|
+ this.Data["json"] = svc.GetTJBysampletype(this.User.AccCode, where)
|
|
|
+ this.ServeJSON()
|
|
|
+}
|
|
|
+
|
|
|
+// @Title 按设备统计样本数量
|
|
|
+// @Description 按设备统计样本数量
|
|
|
+// @Success 200 {object} controllers.Request
|
|
|
+// @router /totalbyeuipment [get]
|
|
|
+func (this *UserController) GetTotalByGroupbydevice() {
|
|
|
+ svcrole := role.GetRoleService(utils.DBE)
|
|
|
+ roleids := svcrole.GetRoleidsByuid(utils.ToStr(this.User.Id))
|
|
|
+ where := " a.AccCode = '" + this.User.AccCode + "'"
|
|
|
+ where = where + " and b.IState =1 and b.DeletionStateCode=0 and (a.CreateUserId=" + utils.ToStr(this.User.Id) + " or a.Id in (select EquipmentId Id FROM Base_RoleEquipment where RoleId in (" + strings.Join(roleids, ",") + ")))"
|
|
|
+
|
|
|
+ svc := samplesinfo.GetSamplesInfoService(utils.DBE)
|
|
|
+
|
|
|
+ this.Data["json"] = svc.GetTJBydevice(this.User.AccCode, where)
|
|
|
+ this.ServeJSON()
|
|
|
+}
|