Commit e33f8ff32b21e80f8d92a3f7d7ac87db8d827582
1 parent
3093391b0c
Exists in
master
提交用户数据权限
Showing 20 changed files with 468 additions and 5 deletions
- parent/base.common/src/main/java/com/lyms/base/common/dao/user/SysUserDataPermissionsMapper.java
- parent/base.common/src/main/java/com/lyms/base/common/dao/user/SysUserDataPermissionsMapper.xml
- parent/base.common/src/main/java/com/lyms/base/common/entity/user/SysUserDataPermissions.java
- parent/base.common/src/main/java/com/lyms/base/common/entity/user/Users.java
- parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganGroupMapsService.java
- parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganizationsService.java
- parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganGroupMapsServiceImpl.java
- parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganizationsServiceImpl.java
- parent/base.common/src/main/java/com/lyms/base/common/service/user/SysUserDataPermissionsService.java
- parent/base.common/src/main/java/com/lyms/base/common/service/user/impl/SysUserDataPermissionsServiceImpl.java
- parent/base.common/src/main/java/com/lyms/base/common/service/user/impl/UsersServiceImpl.java
- parent/center.manager/src/main/java/com/lyms/cm/controller/LoginController.java
- parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysOrganGroupController.java
- parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysOrganizationsController.java
- parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java
- parent/center.manager/src/main/webapp/WEB-INF/views/group/group_edit.html
- parent/center.manager/src/main/webapp/WEB-INF/views/home.html
- parent/center.manager/src/main/webapp/WEB-INF/views/user/user_edit.html
- parent/hospital.web/src/main/java/com/lyms/hospital/controller/LoginController.java
- parent/hospital.web/src/main/resources/rebel.xml
parent/base.common/src/main/java/com/lyms/base/common/dao/user/SysUserDataPermissionsMapper.java
View file @
e33f8ff
| 1 | +package com.lyms.base.common.dao.user; | |
| 2 | + | |
| 3 | +import com.lyms.base.common.entity.user.SysUserDataPermissions; | |
| 4 | +import com.baomidou.mybatisplus.mapper.BaseMapper; | |
| 5 | +import org.springframework.stereotype.Repository; | |
| 6 | +import java.io.Serializable; | |
| 7 | +/** | |
| 8 | + * <p> | |
| 9 | + * Mapper接口 | |
| 10 | + * </p> | |
| 11 | + * | |
| 12 | + * @author fangcheng | |
| 13 | + * @since 2017-04-21 | |
| 14 | + */ | |
| 15 | +@Repository | |
| 16 | +public interface SysUserDataPermissionsMapper extends BaseMapper<SysUserDataPermissions> { | |
| 17 | + | |
| 18 | + public Integer deleteLogicById(Serializable id); | |
| 19 | + | |
| 20 | +} |
parent/base.common/src/main/java/com/lyms/base/common/dao/user/SysUserDataPermissionsMapper.xml
View file @
e33f8ff
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |
| 3 | +<mapper namespace="com.lyms.base.common.dao.user.SysUserDataPermissionsMapper"> | |
| 4 | + | |
| 5 | + <!-- 通用查询映射结果 --> | |
| 6 | + <resultMap id="BaseResultMap" type="com.lyms.base.common.entity.user.SysUserDataPermissions"> | |
| 7 | + <result column="ID" property="id" /> | |
| 8 | + <result column="USER_ID" property="userId" /> | |
| 9 | + <result column="ORG_ID" property="orgId" /> | |
| 10 | + </resultMap> | |
| 11 | + | |
| 12 | + <!-- 通用查询结果列 --> | |
| 13 | + <sql id="Base_Column_List"> | |
| 14 | + ID AS id, USER_ID AS userId, ORG_ID AS orgId | |
| 15 | + </sql> | |
| 16 | +</mapper> |
parent/base.common/src/main/java/com/lyms/base/common/entity/user/SysUserDataPermissions.java
View file @
e33f8ff
| 1 | +package com.lyms.base.common.entity.user; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotations.TableId; | |
| 4 | +import com.baomidou.mybatisplus.annotations.TableField; | |
| 5 | +import com.baomidou.mybatisplus.annotations.TableName; | |
| 6 | +import java.io.Serializable; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * <p> | |
| 10 | + * 用户数据权限关联表 | |
| 11 | + * </p> | |
| 12 | + * | |
| 13 | + * @author fangcheng | |
| 14 | + * @since 2017-04-21 | |
| 15 | + */ | |
| 16 | +@TableName("SYS_USER_DATA_PERMISSIONS") | |
| 17 | +public class SysUserDataPermissions implements Serializable { | |
| 18 | + | |
| 19 | + private static final long serialVersionUID = 1L; | |
| 20 | + | |
| 21 | + /** | |
| 22 | + * | |
| 23 | + */ | |
| 24 | + @TableField(value="ID") | |
| 25 | + private String id; | |
| 26 | + /** | |
| 27 | + * | |
| 28 | + */ | |
| 29 | + @TableField(value="USER_ID") | |
| 30 | + private String userId; | |
| 31 | + /** | |
| 32 | + * | |
| 33 | + */ | |
| 34 | + @TableField(value="ORG_ID") | |
| 35 | + private String orgId; | |
| 36 | + | |
| 37 | + | |
| 38 | + public String getId() { | |
| 39 | + return id; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public void setId(String id) { | |
| 43 | + this.id = id; | |
| 44 | + } | |
| 45 | + | |
| 46 | + public String getUserId() { | |
| 47 | + return userId; | |
| 48 | + } | |
| 49 | + | |
| 50 | + public void setUserId(String userId) { | |
| 51 | + this.userId = userId; | |
| 52 | + } | |
| 53 | + | |
| 54 | + public String getOrgId() { | |
| 55 | + return orgId; | |
| 56 | + } | |
| 57 | + | |
| 58 | + public void setOrgId(String orgId) { | |
| 59 | + this.orgId = orgId; | |
| 60 | + } | |
| 61 | + | |
| 62 | +} |
parent/base.common/src/main/java/com/lyms/base/common/entity/user/Users.java
View file @
e33f8ff
| ... | ... | @@ -140,6 +140,13 @@ |
| 140 | 140 | */ |
| 141 | 141 | @TableField(value = "ENABLE") |
| 142 | 142 | private Integer enable; |
| 143 | + | |
| 144 | + /** | |
| 145 | + * 机构列表数据权限,逗号分隔 | |
| 146 | + */ | |
| 147 | + @TableField(exist=false) | |
| 148 | + private String dataOrgIds; | |
| 149 | + | |
| 143 | 150 | |
| 144 | 151 | |
| 145 | 152 | public String getId() { |
| ... | ... | @@ -333,6 +340,15 @@ |
| 333 | 340 | public void setEnable(Integer enable) { |
| 334 | 341 | this.enable = enable; |
| 335 | 342 | } |
| 343 | + | |
| 344 | + public String getDataOrgIds() { | |
| 345 | + return dataOrgIds; | |
| 346 | + } | |
| 347 | + | |
| 348 | + public void setDataOrgIds(String dataOrgIds) { | |
| 349 | + this.dataOrgIds = dataOrgIds; | |
| 350 | + } | |
| 351 | + | |
| 336 | 352 | |
| 337 | 353 | |
| 338 | 354 | } |
parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganGroupMapsService.java
View file @
e33f8ff
parent/base.common/src/main/java/com/lyms/base/common/service/organ/OrganizationsService.java
View file @
e33f8ff
| ... | ... | @@ -2,6 +2,8 @@ |
| 2 | 2 | |
| 3 | 3 | import java.io.Serializable; |
| 4 | 4 | |
| 5 | +import com.baomidou.mybatisplus.plugins.Page; | |
| 6 | +import com.lyms.base.common.entity.organ.OrganGroup; | |
| 5 | 7 | import com.lyms.base.common.entity.organ.Organizations; |
| 6 | 8 | import com.lyms.exception.SystemException; |
| 7 | 9 | import com.lyms.web.service.BaseService; |
| ... | ... | @@ -59,6 +61,18 @@ |
| 59 | 61 | * <li>修改时间: |
| 60 | 62 | */ |
| 61 | 63 | public boolean deleteOrganById(String id) throws SystemException; |
| 64 | + | |
| 65 | + /** | |
| 66 | + * <li>@Description:获取机构列表 | |
| 67 | + * <li>@param page | |
| 68 | + * <li>@param orgids 逗号分隔 | |
| 69 | + * <li>@return | |
| 70 | + * <li>创建人:方承 | |
| 71 | + * <li>创建时间:2017年4月21日 | |
| 72 | + * <li>修改人: | |
| 73 | + * <li>修改时间: | |
| 74 | + */ | |
| 75 | + public Page<Organizations> listOrgs(Page<Organizations> page,Serializable orgids); | |
| 62 | 76 | |
| 63 | 77 | } |
parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganGroupMapsServiceImpl.java
View file @
e33f8ff
parent/base.common/src/main/java/com/lyms/base/common/service/organ/impl/OrganizationsServiceImpl.java
View file @
e33f8ff
| ... | ... | @@ -2,14 +2,18 @@ |
| 2 | 2 | |
| 3 | 3 | import java.io.Serializable; |
| 4 | 4 | |
| 5 | +import org.apache.commons.lang3.ArrayUtils; | |
| 5 | 6 | import org.springframework.stereotype.Service; |
| 6 | 7 | import org.springframework.transaction.annotation.Transactional; |
| 7 | 8 | |
| 9 | +import com.baomidou.mybatisplus.plugins.Page; | |
| 8 | 10 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| 9 | 11 | import com.lyms.base.common.dao.organ.OrganizationsMapper; |
| 12 | +import com.lyms.base.common.entity.organ.OrganGroup; | |
| 10 | 13 | import com.lyms.base.common.entity.organ.Organizations; |
| 11 | 14 | import com.lyms.base.common.service.organ.OrganizationsService; |
| 12 | 15 | import com.lyms.exception.SystemException; |
| 16 | +import com.lyms.util.CollectionUtils; | |
| 13 | 17 | import com.lyms.util.StrUtils; |
| 14 | 18 | |
| 15 | 19 | /** |
| ... | ... | @@ -53,6 +57,13 @@ |
| 53 | 57 | Integer tag = baseMapper.deleteLogicById(id); |
| 54 | 58 | return tag != null && tag >= 1; |
| 55 | 59 | } |
| 60 | + | |
| 61 | + @Override | |
| 62 | + public Page<Organizations> listOrgs(Page<Organizations> page, Serializable orgids) { | |
| 63 | + String[] orgidsArray = orgids.toString().split(","); | |
| 64 | + page.setRecords(baseMapper.selectBatchIds(CollectionUtils.newArrayList(orgidsArray))); | |
| 65 | + return page; | |
| 66 | + } | |
| 56 | 67 | |
| 57 | 68 | } |
parent/base.common/src/main/java/com/lyms/base/common/service/user/SysUserDataPermissionsService.java
View file @
e33f8ff
| 1 | +package com.lyms.base.common.service.user; | |
| 2 | + | |
| 3 | +import com.lyms.base.common.entity.user.SysUserDataPermissions; | |
| 4 | +import com.lyms.web.service.BaseService; | |
| 5 | +import java.io.Serializable; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * <p> | |
| 9 | + * 服务类 | |
| 10 | + * </p> | |
| 11 | + * | |
| 12 | + * @author fangcheng | |
| 13 | + * @since 2017-04-21 | |
| 14 | + */ | |
| 15 | +public interface SysUserDataPermissionsService extends BaseService<SysUserDataPermissions> { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * <li>@Description:逻辑删除,ifDel = 1 为删除,否则为没有删除 | |
| 19 | + * <li>@param id 删除主键id | |
| 20 | + * <li>@return 大于0修改成功,否则为失败 | |
| 21 | + */ | |
| 22 | + public Integer deleteLogicById(Serializable id); | |
| 23 | + | |
| 24 | +} |
parent/base.common/src/main/java/com/lyms/base/common/service/user/impl/SysUserDataPermissionsServiceImpl.java
View file @
e33f8ff
| 1 | +package com.lyms.base.common.service.user.impl; | |
| 2 | + | |
| 3 | +import com.lyms.base.common.entity.user.SysUserDataPermissions; | |
| 4 | +import com.lyms.base.common.dao.user.SysUserDataPermissionsMapper; | |
| 5 | +import com.lyms.base.common.service.user.SysUserDataPermissionsService; | |
| 6 | +import com.baomidou.mybatisplus.service.impl.ServiceImpl; | |
| 7 | +import org.springframework.stereotype.Service; | |
| 8 | +import java.io.Serializable; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * <p> | |
| 12 | + * 用户数据权限关联表 服务实现类 | |
| 13 | + * </p> | |
| 14 | + * | |
| 15 | + * @author fangcheng | |
| 16 | + * @since 2017-04-21 | |
| 17 | + */ | |
| 18 | +@Service | |
| 19 | +public class SysUserDataPermissionsServiceImpl extends ServiceImpl<SysUserDataPermissionsMapper, SysUserDataPermissions> implements SysUserDataPermissionsService { | |
| 20 | + | |
| 21 | + public Integer deleteLogicById(Serializable id){ | |
| 22 | + return baseMapper.deleteLogicById(id); | |
| 23 | + } | |
| 24 | +} |
parent/base.common/src/main/java/com/lyms/base/common/service/user/impl/UsersServiceImpl.java
View file @
e33f8ff
| ... | ... | @@ -11,8 +11,10 @@ |
| 11 | 11 | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| 12 | 12 | import com.baomidou.mybatisplus.service.impl.ServiceImpl; |
| 13 | 13 | import com.lyms.annotation.DataSourceChange; |
| 14 | +import com.lyms.base.common.dao.user.SysUserDataPermissionsMapper; | |
| 14 | 15 | import com.lyms.base.common.dao.user.UsersMapper; |
| 15 | 16 | import com.lyms.base.common.entity.role.UserRoleMaps; |
| 17 | +import com.lyms.base.common.entity.user.SysUserDataPermissions; | |
| 16 | 18 | import com.lyms.base.common.entity.user.Users; |
| 17 | 19 | import com.lyms.base.common.enums.ValidityEnum; |
| 18 | 20 | import com.lyms.base.common.service.role.UserRoleMapsService; |
| ... | ... | @@ -35,6 +37,8 @@ |
| 35 | 37 | |
| 36 | 38 | @Autowired |
| 37 | 39 | private UsersMapper userMapper; |
| 40 | + @Autowired | |
| 41 | + private SysUserDataPermissionsMapper sysUserDataPermissionsMapper; | |
| 38 | 42 | |
| 39 | 43 | @Autowired |
| 40 | 44 | private UserRoleMapsService sysUserRoleMapsService; |
| ... | ... | @@ -80,6 +84,17 @@ |
| 80 | 84 | this.initPwd(user); |
| 81 | 85 | |
| 82 | 86 | Integer tag = userMapper.insert(user); |
| 87 | + | |
| 88 | + String[] dataPermissionArray = user.getDataOrgIds().split(","); | |
| 89 | + if(dataPermissionArray != null && dataPermissionArray.length > 0){ | |
| 90 | + for(String orgid : dataPermissionArray ){ | |
| 91 | + SysUserDataPermissions dataEntity = new SysUserDataPermissions(); | |
| 92 | + dataEntity.setId(StrUtils.uuid()); | |
| 93 | + dataEntity.setOrgId(orgid); | |
| 94 | + dataEntity.setUserId(user.getId()); | |
| 95 | + sysUserDataPermissionsMapper.insert(dataEntity); | |
| 96 | + } | |
| 97 | + } | |
| 83 | 98 | if (userRoleMapsList != null && !userRoleMapsList.isEmpty()) { |
| 84 | 99 | sysUserRoleMapsService.insertBatch(userRoleMapsList); |
| 85 | 100 | } |
| ... | ... | @@ -103,6 +118,19 @@ |
| 103 | 118 | } |
| 104 | 119 | |
| 105 | 120 | Integer tag = userMapper.updateById(user); |
| 121 | + | |
| 122 | + sysUserDataPermissionsMapper.delete(new EntityWrapper<SysUserDataPermissions>().where("USER_ID={0}", user.getId())); | |
| 123 | + String[] dataPermissionArray = user.getDataOrgIds().split(","); | |
| 124 | + if(dataPermissionArray != null && dataPermissionArray.length > 0){ | |
| 125 | + for(String orgid : dataPermissionArray ){ | |
| 126 | + SysUserDataPermissions dataEntity = new SysUserDataPermissions(); | |
| 127 | + dataEntity.setId(StrUtils.uuid()); | |
| 128 | + dataEntity.setOrgId(orgid); | |
| 129 | + dataEntity.setUserId(user.getId()); | |
| 130 | + sysUserDataPermissionsMapper.insert(dataEntity); | |
| 131 | + } | |
| 132 | + } | |
| 133 | + | |
| 106 | 134 | EntityWrapper<UserRoleMaps> ew = new EntityWrapper<UserRoleMaps>(); |
| 107 | 135 | ew.where("user_id={0}", user.getId()); |
| 108 | 136 | sysUserRoleMapsService.delete(ew); |
parent/center.manager/src/main/java/com/lyms/cm/controller/LoginController.java
View file @
e33f8ff
| ... | ... | @@ -84,6 +84,7 @@ |
| 84 | 84 | public String login(String username, String password, |
| 85 | 85 | @RequestParam(value = "rememberMe", defaultValue = "0") int rememberMe, Model model) { |
| 86 | 86 | String view = VIEW_LOGIN; |
| 87 | + System.out.println(1243); | |
| 87 | 88 | if (StrUtils.isEmpty(username) || StrUtils.isEmpty(password)) { |
| 88 | 89 | model.addAttribute(Constants.CAPTCHA_TOKEN, StrUtils.uuid()); |
| 89 | 90 | return view; |
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysOrganGroupController.java
View file @
e33f8ff
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysOrganizationsController.java
View file @
e33f8ff
| ... | ... | @@ -13,9 +13,11 @@ |
| 13 | 13 | |
| 14 | 14 | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| 15 | 15 | import com.baomidou.mybatisplus.plugins.Page; |
| 16 | +import com.lyms.base.common.entity.organ.OrganGroup; | |
| 16 | 17 | import com.lyms.base.common.entity.organ.Organizations; |
| 17 | 18 | import com.lyms.base.common.service.organ.OrganizationsService; |
| 18 | 19 | import com.lyms.constants.OperationName; |
| 20 | +import com.lyms.util.StrUtils; | |
| 19 | 21 | import com.lyms.web.bean.AjaxResult; |
| 20 | 22 | import com.lyms.web.controller.BaseController; |
| 21 | 23 | |
| ... | ... | @@ -136,6 +138,16 @@ |
| 136 | 138 | boolean tag = organService.deleteOrganById(id); |
| 137 | 139 | return handleAjaxResult(ajaxResult, tag, OperationName.DELETE); |
| 138 | 140 | } |
| 141 | + | |
| 142 | + @ResponseBody | |
| 143 | + @RequestMapping(value = "/listOrgs/{orgids}", method = { RequestMethod.GET, RequestMethod.POST }) | |
| 144 | + public Map<String, Object> listOrgs(@PathVariable String orgids) { | |
| 145 | + Page<Organizations> page = getPage(); | |
| 146 | + if(StrUtils.isNotEmpty(orgids)){ | |
| 147 | + page = organService.listOrgs(page,orgids); | |
| 148 | + } | |
| 149 | + return toGridData(page); | |
| 150 | + } | |
| 139 | 151 | |
| 140 | 152 | } |
parent/center.manager/src/main/java/com/lyms/cm/controller/sys/SysUsersController.java
View file @
e33f8ff
| ... | ... | @@ -16,9 +16,11 @@ |
| 16 | 16 | import com.baomidou.mybatisplus.plugins.Page; |
| 17 | 17 | import com.lyms.base.common.entity.role.Roles; |
| 18 | 18 | import com.lyms.base.common.entity.role.UserRoleMaps; |
| 19 | +import com.lyms.base.common.entity.user.SysUserDataPermissions; | |
| 19 | 20 | import com.lyms.base.common.entity.user.Users; |
| 20 | 21 | import com.lyms.base.common.service.role.RolesService; |
| 21 | 22 | import com.lyms.base.common.service.role.UserRoleMapsService; |
| 23 | +import com.lyms.base.common.service.user.SysUserDataPermissionsService; | |
| 22 | 24 | import com.lyms.base.common.service.user.UsersService; |
| 23 | 25 | import com.lyms.constants.OperationName; |
| 24 | 26 | import com.lyms.util.InstanceUtils; |
| ... | ... | @@ -45,6 +47,8 @@ |
| 45 | 47 | private RolesService sysRolesService; |
| 46 | 48 | @Autowired |
| 47 | 49 | private UserRoleMapsService sysUserRoleMapsService; |
| 50 | + @Autowired | |
| 51 | + private SysUserDataPermissionsService sysUserDataPermissionsService; | |
| 48 | 52 | |
| 49 | 53 | /** |
| 50 | 54 | * 创建用户 |
| ... | ... | @@ -137,6 +141,15 @@ |
| 137 | 141 | // 所有角色数据 |
| 138 | 142 | List<Roles> roleList = sysRolesService.selectList(new EntityWrapper<Roles>().where("ifDel=0")); |
| 139 | 143 | model.addAttribute("roleString", toJson(roleList)); |
| 144 | + | |
| 145 | + | |
| 146 | + //数据权限 | |
| 147 | + List<SysUserDataPermissions> dataPermissionList = sysUserDataPermissionsService.selectList(new EntityWrapper<SysUserDataPermissions>().where("USER_ID={0}", id)); | |
| 148 | + StringBuilder dataOrgids =new StringBuilder(); | |
| 149 | + for(SysUserDataPermissions datap : dataPermissionList){ | |
| 150 | + dataOrgids.append(","+datap.getOrgId()); | |
| 151 | + } | |
| 152 | + model.addAttribute("dataOrgids",dataOrgids.toString().replaceFirst(",", "")); | |
| 140 | 153 | return "/user/user_edit"; |
| 141 | 154 | } |
| 142 | 155 |
parent/center.manager/src/main/webapp/WEB-INF/views/group/group_edit.html
View file @
e33f8ff
parent/center.manager/src/main/webapp/WEB-INF/views/home.html
View file @
e33f8ff
parent/center.manager/src/main/webapp/WEB-INF/views/user/user_edit.html
View file @
e33f8ff
| ... | ... | @@ -179,6 +179,14 @@ |
| 179 | 179 | </label> |
| 180 | 180 | </div> |
| 181 | 181 | </div> |
| 182 | + <div class="form-group"> | |
| 183 | + <label class="col-sm-3 control-label">医院权限列表:</label> | |
| 184 | + <button class="btn btn-info " type="button" onclick="del();"><i class="fa fa-trash"></i> 移除</button> | |
| 185 | + </div> | |
| 186 | + <div class="form-group"> | |
| 187 | + <input type="hidden" id="dataOrgIds" name="dataOrgIds" value="${dataOrgids}"/> | |
| 188 | + <table id="orgList"></table> | |
| 189 | + </div> | |
| 182 | 190 | <div class="hr-line-dashed"></div> |
| 183 | 191 | <div class="form-group"> |
| 184 | 192 | <div class="col-sm-4 col-sm-offset-3 pull-right"> |
| 185 | 193 | |
| ... | ... | @@ -193,9 +201,63 @@ |
| 193 | 201 | <ul id="tree_resource" class="ztree" style="margin-top:0; width:180px; height: 250px;"></ul> |
| 194 | 202 | </div> |
| 195 | 203 | </div> |
| 204 | + <div class="col-sm-8"> | |
| 205 | + <div style="padding-top:30px;"> | |
| 206 | + <form class="form-inline"> | |
| 207 | + <div class="form-group"> | |
| 208 | + <input type="text" placeholder="请输入医院名过滤" id="groupName" name="groupName" class="form-control"> | |
| 209 | + </div> | |
| 210 | + <div class="form-group" onclick="search();"> | |
| 211 | + <a class="btn btn-primary"><i class="fa fa-search"></i> 查询</a> | |
| 212 | + </div> | |
| 213 | + <div class="form-group" onclick="add();"> | |
| 214 | + <a class="btn btn-primary"><i class="fa fa-plus"></i> 添加</a> | |
| 215 | + </div> | |
| 216 | + </form> | |
| 217 | + </div> | |
| 218 | + <table id="dataTable"></table> | |
| 219 | + </div> | |
| 196 | 220 | </div> |
| 197 | 221 | </div> |
| 198 | 222 | <script type="text/javascript"> |
| 223 | + function search(){ | |
| 224 | + var queryParams = { | |
| 225 | + query:{ | |
| 226 | + name: $("#groupName").val() | |
| 227 | + } | |
| 228 | + } | |
| 229 | + $('#dataTable').bootstrapTable('refresh', queryParams ); | |
| 230 | + } | |
| 231 | + function add(){ | |
| 232 | + var list = $('#dataTable').bootstrapTable('getSelections'); | |
| 233 | + for(var i = 0 ; i< list.length ; i++){ | |
| 234 | + if(! $('#orgList').bootstrapTable('getRowByUniqueId', list[i]['id'])){ | |
| 235 | + var row = []; | |
| 236 | + row.push({ | |
| 237 | + id: list[i]['id'], | |
| 238 | + name: list[i]['name'] | |
| 239 | + }); | |
| 240 | + $('#orgList').bootstrapTable('append', row); | |
| 241 | + } | |
| 242 | + } | |
| 243 | + $('#dataOrgIds').val(getOrgIds()); | |
| 244 | + } | |
| 245 | + function del(){ | |
| 246 | + var list = $('#orgList').bootstrapTable('getSelections'); | |
| 247 | + for(var i = 0 ; i< list.length ; i++){ | |
| 248 | + $('#orgList').bootstrapTable('remove', {field: 'id', values: list[i]['id']}); | |
| 249 | + } | |
| 250 | + $('#dataOrgIds').val(getOrgIds()); | |
| 251 | + } | |
| 252 | + function getOrgIds(){ | |
| 253 | + var list = $('#orgList').bootstrapTable('getData'); | |
| 254 | + var ids = []; | |
| 255 | + for(var i = 0 ;i < list.length ;i++){ | |
| 256 | + ids.push(list[i]['id']); | |
| 257 | + } | |
| 258 | + return ids.join(','); | |
| 259 | + } | |
| 260 | + | |
| 199 | 261 | function save(){ |
| 200 | 262 | if($('#validForm').valid()){ |
| 201 | 263 | var data = $('#validForm').serialize(); |
| 202 | 264 | |
| ... | ... | @@ -208,7 +270,164 @@ |
| 208 | 270 | parent.reloadGrid('dataTable'); |
| 209 | 271 | } |
| 210 | 272 | } |
| 273 | + | |
| 274 | + //机构列表-begin | |
| 275 | + var controllerRequestMappint = "/sysOrganizations/"; | |
| 276 | + | |
| 277 | +## 参考 base_table_init.js 或者根据empty_bootstrap_table_init.js 来自己创建特殊的table | |
| 278 | +## 注意:自己创建的特殊的table不能extends base_list.html | |
| 279 | +var default_dataUrl = APP.PATH + controllerRequestMappint + "list"; | |
| 280 | +var default_dataColumns = [{ | |
| 281 | + field: 'check_state', | |
| 282 | + title: '', | |
| 283 | + checkbox: true | |
| 284 | + },{ | |
| 285 | + field: 'id', | |
| 286 | + title: '编号' | |
| 287 | + },{ | |
| 288 | + field: 'name', | |
| 289 | + title: '名称' | |
| 290 | + },{ | |
| 291 | + field: 'type', | |
| 292 | + title: '类型', | |
| 293 | + formatter:function(value,row,index){ | |
| 294 | + //1:卫生与计划生育委员会,2:妇幼保健院/站,3:妇产(科)医院,4:综合医院,5:计生站,6:卫生院,7:卫生所,8:其他 | |
| 295 | + switch(value){ | |
| 296 | + case 1:return "卫生与计划生育委员会"; | |
| 297 | + case 2:return "妇幼保健院/站"; | |
| 298 | + case 3:return "妇产(科)医院"; | |
| 299 | + case 4:return "综合医院"; | |
| 300 | + case 5:return "计生站"; | |
| 301 | + case 6:return "卫生院"; | |
| 302 | + case 7:return "卫生所"; | |
| 303 | + case 8:return "其他"; | |
| 304 | + } | |
| 305 | + } | |
| 306 | + },{ | |
| 307 | + field: 'shortCode', | |
| 308 | + title: '简码' | |
| 309 | + },{ | |
| 310 | + field: 'level', | |
| 311 | + title: '等级', | |
| 312 | + formatter:function(value,row,index){ | |
| 313 | + switch (value) { | |
| 314 | + case 1:return "省"; | |
| 315 | + case 2:return "市"; | |
| 316 | + case 3:return "区县"; | |
| 317 | + case 4:return "乡镇"; | |
| 318 | + case 5:return "村"; | |
| 319 | + case 6:return "其他"; | |
| 320 | + | |
| 321 | + default: | |
| 322 | + return ""; | |
| 323 | + } | |
| 324 | + } | |
| 325 | + },{ | |
| 326 | + field: 'gradeLevel', | |
| 327 | + title: '医院等级' | |
| 328 | + },{ | |
| 329 | + field: 'mobile', | |
| 330 | + title: '服务热线' | |
| 331 | + },{ | |
| 332 | + field: 'starLevel', | |
| 333 | + title: '星级' | |
| 334 | + },{ | |
| 335 | + field: 'status', | |
| 336 | + title: '状态', | |
| 337 | + formatter:function(value,row,index){ | |
| 338 | + switch (value) { | |
| 339 | + case 0: return "正式运行"; | |
| 340 | + case 1: return "试运行"; | |
| 341 | + case 2: return "停止运行"; | |
| 342 | + default: | |
| 343 | + break; | |
| 344 | + } | |
| 345 | + } | |
| 346 | + },{ | |
| 347 | + field: 'address', | |
| 348 | + title: '地址' | |
| 349 | + }]; | |
| 350 | + //机构列表-end | |
| 351 | + | |
| 352 | + | |
| 211 | 353 | </script> |
| 212 | 354 | #end |
| 213 | 355 | #extends("/common/base_list.html") |
| 356 | + | |
| 357 | + | |
| 358 | +<script type="text/javascript"> | |
| 359 | +//拥有医院列表 | |
| 360 | +$(function () { | |
| 361 | + var orgListTable = new orgLostTableInit(); | |
| 362 | + orgListTable.Init(); | |
| 363 | +}) | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | +var orgLostTableInit = function () { | |
| 368 | + var orgListTableInit = new Object(); | |
| 369 | + //初始化Table | |
| 370 | + orgListTableInit.Init = function () { | |
| 371 | + $('#orgList').bootstrapTable({ | |
| 372 | + url: '${ctx}/sysOrganizations/listOrgs/$!dataOrgids', //请求后台的URL(*) | |
| 373 | + method: 'get', //请求方式(*) | |
| 374 | + striped: true, //是否显示行间隔色 | |
| 375 | + cache: false, //是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*) | |
| 376 | + sortable: false, //是否启用排序 | |
| 377 | + queryParams: orgListTableInit.queryParams,//传递参数(*) | |
| 378 | + sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*) | |
| 379 | + pageNumber:1, //初始化加载第一页,默认第一页 | |
| 380 | + pageSize: 999, //每页的记录行数(*) | |
| 381 | + pageList: [999], //可供选择的每页的行数(*) | |
| 382 | + strictSearch: true, | |
| 383 | + clickToSelect: true, //是否启用点击选中行 | |
| 384 | + //height: 600, //行高,如果没有设置height属性,表格自动根据记录条数觉得表格高度 | |
| 385 | + uniqueId: "id", //每一行的唯一标识,一般为主键列 | |
| 386 | + cardView: false, //是否显示详细视图 | |
| 387 | + detailView: false, //是否显示父子表 | |
| 388 | + columns: [{ | |
| 389 | + field: 'check_state', | |
| 390 | + title: '', | |
| 391 | + checkbox: true | |
| 392 | + },{ | |
| 393 | + field: 'id', | |
| 394 | + title: '序号', | |
| 395 | + visible: false | |
| 396 | + }, { | |
| 397 | + field: 'name', | |
| 398 | + title: '医院名称' | |
| 399 | + }], | |
| 400 | + onLoadSuccess: function(){ //加载成功时执行 | |
| 401 | + var list = $('#orgList').bootstrapTable('getData'); | |
| 402 | + var ids = []; | |
| 403 | + for(var i = 0 ;i< list.length ; i++ ){ | |
| 404 | + ids.push(list[i]['id']); | |
| 405 | + } | |
| 406 | + $('#orgIds').val(ids.join(',')); | |
| 407 | + } | |
| 408 | + }); | |
| 409 | + }; | |
| 410 | + | |
| 411 | + //得到查询的参数 | |
| 412 | + orgListTableInit.queryParams = function (params) { | |
| 413 | + var temp = { //这里的键的名字和控制器的变量名必须一直,这边改动,控制器也需要改成一样的 | |
| 414 | + _size: 999, //每页记录数 | |
| 415 | + _offset: 1 , //偏移量 | |
| 416 | + /*sdate: $("#stratTime").val(), | |
| 417 | + edate: $("#endTime").val(), | |
| 418 | + sellerid: $("#sellerid").val(), | |
| 419 | + orderid: $("#orderid").val(), | |
| 420 | + CardNumber: $("#CardNumber").val(), | |
| 421 | + maxrows: params.limit, | |
| 422 | + pageindex: params.pageNumber, | |
| 423 | + portid: $("#portid").val(), | |
| 424 | + CardNumber: $("#CardNumber").val(), | |
| 425 | + tradetype: $('input:radio[name="tradetype"]:checked').val(), | |
| 426 | + success: $('input:radio[name="success"]:checked').val(),*/ | |
| 427 | + }; | |
| 428 | + return temp; | |
| 429 | + }; | |
| 430 | + return orgListTableInit; | |
| 431 | +}; | |
| 432 | +</script> |
parent/hospital.web/src/main/java/com/lyms/hospital/controller/LoginController.java
View file @
e33f8ff
parent/hospital.web/src/main/resources/rebel.xml
View file @
e33f8ff