| | |
| | | * 销售代表名称 |
| | | */ |
| | | private String serverUserName; |
| | | /** |
| | | * 创建者的部门 |
| | | */ |
| | | private String createUserOrgCode; |
| | | } |
| | |
| | | package com.kidgrow.usercenter.model; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.*; |
| | | import com.kidgrow.common.model.SuperModel; |
| | | import com.baomidou.mybatisplus.annotation.FieldFill; |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | import com.baomidou.mybatisplus.extension.activerecord.Model; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.Data; |
| | |
| | | /** |
| | | * 是否删除,1删除,0未删除 |
| | | */ |
| | | @TableLogic |
| | | private Boolean isDel; |
| | | } |
| | |
| | | |
| | | ResultBody enable(Map<String, Object> params); |
| | | |
| | | boolean saveOrUpdateSer(SysDoctorDto sysDoctor, HttpServletRequest request); |
| | | boolean saveOrUpdateSer(SysDoctorDto sysDoctor, HttpServletRequest request,SysUser user); |
| | | } |
| | | |
| | |
| | | @Autowired |
| | | private RedisUtils redisUtils; |
| | | @Autowired |
| | | private SysRoleOrganizationMapper sysRoleOrganizationMapper; |
| | | @Autowired |
| | | private SysRoleMapper sysRoleMapper; |
| | | private SysRoleOrganizationServiceImpl SysRoleOrganizationServiceImpl; |
| | | |
| | | |
| | | @Override |
| | | public PageResult<SysDoctorVo> findList(Map<String, Object> params, SysUser user) { |
| | | Page<SysDoctor> page = new Page<>(MapUtils.getInteger(params, "page"), MapUtils.getInteger(params, "limit")); |
| | | List<SysRole> roles = user.getRoles(); |
| | | List<Map<SysRole,List<SysRoleOrganization>>> listroleOrg=new ArrayList<>(); |
| | | if (!roles.isEmpty()) { |
| | | roles.forEach(e->{ |
| | | Map<SysRole,List<SysRoleOrganization>> rolemap=new HashMap<>(); |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("role_id",e.getId()); |
| | | List<SysRoleOrganization> sysRoleOrganizations = sysRoleOrganizationMapper.selectByMap(map); |
| | | if(sysRoleOrganizations.size()>0){ |
| | | SysRole sysRole = sysRoleMapper.selectById(e.getId()); |
| | | rolemap.put(sysRole,sysRoleOrganizations); |
| | | listroleOrg.add(rolemap); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | params.put("likes",listroleOrg); |
| | | //添加权限 |
| | | SysRoleOrganizationServiceImpl.getRoleOrg(params, user); |
| | | List<SysDoctor> list = baseMapper.findList(page, params); |
| | | List<SysDoctorVo> listvo = new ArrayList<>(); |
| | | list.forEach(e -> { |
| | |
| | | |
| | | @Override |
| | | @Transactional |
| | | public boolean saveOrUpdateSer(SysDoctorDto sysDoctor, HttpServletRequest request) { |
| | | public boolean saveOrUpdateSer(SysDoctorDto sysDoctor, HttpServletRequest request,SysUser user) { |
| | | String id = request.getHeader(SecurityConstants.USER_ID_HEADER); |
| | | if(null==sysDoctor){ |
| | | return false; |
| | |
| | | BeanCopier beanCopier = BeanCopier.create(SysDoctorDto.class, SysDoctor.class, false); |
| | | beanCopier.copy(sysDoctor,sysDoc,null); |
| | | sysDoc.setUserId(sysUser.getId()); |
| | | if(user.getOrganizations()!=null){ |
| | | List<SysOrganization> organizations = user.getOrganizations(); |
| | | sysDoc.setCreateUserOrgCode(organizations.get(organizations.size()-1).getOrgCode()); |
| | | } |
| | | |
| | | baseMapper.insert(sysDoc); |
| | | //保存将sys_user_org |
| | | SysUserOrg sysUserOrg=new SysUserOrg(); |
| | |
| | | |
| | | @Override |
| | | public ResultBody<SysHospital> findAll(Map<String, Object> params) { |
| | | params.put("is_del",0); |
| | | params.put("enabled",1); |
| | | List<SysHospital> sysHospitals = baseMapper.selectByMap(params); |
| | | return ResultBody.ok().data(sysHospitals).msg("查询成功"); |
| | | } |
| | |
| | | import com.kidgrow.common.annotation.LoginUser; |
| | | import com.kidgrow.common.model.*; |
| | | import com.kidgrow.usercenter.dto.SysRoleOrganizationDto; |
| | | import com.kidgrow.usercenter.mapper.SysRoleMapper; |
| | | import com.kidgrow.usercenter.service.ISysOrganizationService; |
| | | import com.kidgrow.usercenter.service.ISysRoleService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | private ISysRoleService iSysRoleService; |
| | | @Autowired |
| | | private SysOrganizationServiceImpl sysOrganizationService; |
| | | @Autowired |
| | | private SysRoleMapper sysRoleMapper; |
| | | |
| | | /** |
| | | * 列表 |
| | |
| | | } |
| | | return listMap; |
| | | } |
| | | public void getRoleOrg(Map<String, Object> params, SysUser user){ |
| | | List<SysRole> roles = user.getRoles(); |
| | | List<Map<SysRole,List<SysRoleOrganization>>> listroleOrg=new ArrayList<>(); |
| | | if (!roles.isEmpty()) { |
| | | roles.forEach(e->{ |
| | | Map<SysRole,List<SysRoleOrganization>> rolemap=new HashMap<>(); |
| | | Map<String,Object> map=new HashMap<>(); |
| | | map.put("role_id",e.getId()); |
| | | List<SysRoleOrganization> sysRoleOrganizations = baseMapper.selectByMap(map); |
| | | if(sysRoleOrganizations.size()>0){ |
| | | SysRole sysRole = sysRoleMapper.selectById(e.getId()); |
| | | rolemap.put(sysRole,sysRoleOrganizations); |
| | | listroleOrg.add(rolemap); |
| | | } |
| | | }); |
| | | } |
| | | //添加权限控制 |
| | | params.put("roleOrg",listroleOrg); |
| | | } |
| | | } |
| | |
| | | and doctor_logo = #{p.doctorLogo} |
| | | </if> |
| | | <if test="p.doctorTel != null and p.doctorTel !=''"> |
| | | and doctor_tel like '%${p.doctorTel}%' |
| | | and doctor_tel like concat('%',#{p.doctorTel},'%') |
| | | </if> |
| | | <if test="p.doctorRankId != null and p.doctorRankId !=''"> |
| | | and doctor_rank_id = #{p.doctorRankId} |
| | |
| | | <if test="p.updateTime != null and p.updateTime !=''"> |
| | | and update_time = #{p.updateTime} |
| | | </if> |
| | | <if test="p.likes != null and p.likes.size>0"> |
| | | |
| | | <foreach item="item" collection="p.likes" index=""> |
| | | <foreach item="itemto" collection="item" index="inx"> |
| | | |
| | | |
| | | <choose> |
| | | <when test="inx.type == 1"></when> |
| | | |
| | | <when test="inx.type==2"> |
| | | AND |
| | | <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> |
| | | create_user_org_code like '${itemtoto.orgCode}%' |
| | | </foreach> |
| | | </when> |
| | | <when test="inx.type == 3"> |
| | | AND |
| | | <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> |
| | | create_user_org_code = #{itemtoto.orgCode} |
| | | </foreach> |
| | | </when> |
| | | <when test="inx.type == 4"> |
| | | AND |
| | | <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> |
| | | create_user_org_code like '${itemtoto.orgCode}%' |
| | | </foreach> |
| | | </when> |
| | | <when test="inx.type == 5"> |
| | | AND |
| | | <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> |
| | | create_user_id = #{itemtoto.orgCode} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | AND id is null |
| | | </otherwise> |
| | | </choose> |
| | | |
| | | </foreach> |
| | | </foreach> |
| | | </if> |
| | | <include refid="com.kidgrow.usercenter.mapper.SysRoleOrganizationMapper.Role_Organization"/> |
| | | </where> |
| | | </sql> |
| | | |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <!--角色对应的 部门--> |
| | | <mapper namespace="com.kidgrow.usercenter.mapper.SysRoleOrganizationMapper"> |
| | | |
| | | <!--定义数据权限的查询--> |
| | | <sql id="Role_Organization"> |
| | | <if test="p.roleOrg != null and p.roleOrg.size>0"> |
| | | |
| | | <foreach item="item" collection="p.roleOrg" index=""> |
| | | <foreach item="itemto" collection="item" index="inx"> |
| | | |
| | | |
| | | <choose> |
| | | <when test="inx.type == 1"></when> |
| | | |
| | | <when test="inx.type==2"> |
| | | AND |
| | | <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> |
| | | create_user_org_code like '${itemtoto.orgCode}%' |
| | | </foreach> |
| | | </when> |
| | | <when test="inx.type == 3"> |
| | | AND |
| | | <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> |
| | | create_user_org_code = #{itemtoto.orgCode} |
| | | </foreach> |
| | | </when> |
| | | <when test="inx.type == 4"> |
| | | AND |
| | | <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> |
| | | create_user_org_code like '${itemtoto.orgCode}%' |
| | | </foreach> |
| | | </when> |
| | | <when test="inx.type == 5"> |
| | | AND |
| | | <foreach item="itemtoto" collection="itemto" separator="or" open="(" close=")" index=""> |
| | | create_user_id = #{itemtoto.orgCode} |
| | | </foreach> |
| | | </when> |
| | | <otherwise> |
| | | AND id is null |
| | | </otherwise> |
| | | </choose> |
| | | |
| | | </foreach> |
| | | </foreach> |
| | | </if> |
| | | </sql> |
| | | |
| | | <!--定义查询列--> |
| | | <sql id="Column_List"> |
| | | * |
| | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/sysdoctor") |
| | | @Api(tags = "") |
| | | @Api(tags = "医生表") |
| | | public class SysDoctorController extends BaseController{ |
| | | @Autowired |
| | | private ISysDoctorService sysDoctorService; |
| | |
| | | */ |
| | | @ApiOperation(value = "保存") |
| | | @PostMapping |
| | | public ResultBody save(@Valid @RequestBody SysDoctorDto sysDoctor, BindingResult bindingResult, HttpServletRequest request) { |
| | | public ResultBody save(@Valid @RequestBody SysDoctorDto sysDoctor, BindingResult bindingResult, HttpServletRequest request,@LoginUser SysUser user) { |
| | | List<String> errMsg= new ArrayList<>(); |
| | | if (bindingResult.hasErrors()) { |
| | | for (ObjectError error : bindingResult.getAllErrors()) { |
| | |
| | | } |
| | | return ResultBody.failed().msg(errMsg.toString()); |
| | | } else { |
| | | boolean v= sysDoctorService.saveOrUpdateSer(sysDoctor,request); |
| | | boolean v= sysDoctorService.saveOrUpdateSer(sysDoctor,request,user); |
| | | |
| | | if(v) { |
| | | return ResultBody.ok().data(sysDoctor).msg("保存成功"); |
| | |
| | | } |
| | | } |
| | | |
| | | @PostMapping("findAllByMap") |
| | | @ApiOperation(value = "查询所有列表") |
| | | public ResultBody<SysHospital> findAllByMap(@RequestBody Map<String, Object> params) { |
| | | return sysHospitalService.findAll(params); |
| | | } |
| | | |
| | | /** |
| | | * 查询 |
| | | */ |
| | |
| | | @Slf4j |
| | | @RestController |
| | | @RequestMapping("/sysuserorg") |
| | | @Api(tags = "") |
| | | @Api(tags = "用户与部门") |
| | | public class SysUserOrgController { |
| | | @Autowired |
| | | private ISysUserOrgService iSysUserOrgService; |
| | |
| | | var doctorRank = ""; |
| | | // 获取应用列表 |
| | | // layer.load(2); |
| | | admin.req('api-user/syshospital/findAll', JSON.stringify({ is_del: 0 }), function (data) { |
| | | admin.req('api-user/syshospital/findAllByMap', JSON.stringify({ is_del: 0 }), function (data) { |
| | | layer.closeAll('loading'); |
| | | if (0 === data.code) { |
| | | let selected = false; |