Commit 956022c8 authored by maqing's avatar maqing

用户和护理机构权限问题

parent 40eb8840
......@@ -9,6 +9,7 @@ import com.hungraim.ltc.service.DisableService;
import com.hungraim.ltc.util.FileUtils;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.TokenParsingUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.ss.usermodel.Workbook;
......@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
/**
......@@ -70,8 +72,9 @@ public class DisableController {
* 查询所有父机构
*/
@RequestMapping("/fndOrganRoot")
public Result<List<ChFndOrgan>> fndOrganRoot() {
List<ChFndOrgan> organs = disableService.fndOrganRoot();
public Result<List<ChFndOrgan>> fndOrganRoot(@RequestHeader("Authorization") String token) {
long organId = TokenParsingUtil.TokenParsing(token, "organId");
List<ChFndOrgan> organs = disableService.fndOrganRoot(organId);
return Result.success(organs);
}
......@@ -79,8 +82,9 @@ public class DisableController {
* 查询所有机构
*/
@RequestMapping("/fndAllOrgan")
public Result<List<ChFndOrgan>> fndAllOrgan() {
List<ChFndOrgan> organs = disableService.fndAllOrgan();
public Result<List<ChFndOrgan>> fndAllOrgan(@RequestHeader("Authorization") String token) {
long organId = TokenParsingUtil.TokenParsing(token, "organId");
List<ChFndOrgan> organs = disableService.fndAllOrgan(organId);
return Result.success(organs);
}
......@@ -96,31 +100,29 @@ public class DisableController {
/**
* 查询机构(不包含子机构)下所有护理机构
*
* @param organId 机构id
* @param token
*/
@RequestMapping("/srvOrganList")
public Result<List<ChSrvOrgan>> srvOrganList(String organId) {
if (StringUtils.isBlank(organId)) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
List<ChSrvOrgan> chFndSrvModes = disableService.srvOrganList(organId, false);
public Result<List<ChSrvOrgan>> srvOrganList(@RequestHeader("Authorization") String token) {
long organId = TokenParsingUtil.TokenParsing(token, "organId");
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
List<ChSrvOrgan> chFndSrvModes = disableService.srvOrganList(String.valueOf(organId), srvOrganId, false);
return Result.success(chFndSrvModes);
}
/**
* 查询机构下或者包含子机构下的所有护理机构
*
* @param organId 机构id
* @param 机构id
*/
@RequestMapping("/srvOrganListByIsInvolveChild")
public Result<List<ChSrvOrgan>> srvOrganListByIsInvolveChild(String organId, Boolean isInvolveChild) {
if (StringUtils.isBlank(organId)) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
public Result<List<ChSrvOrgan>> srvOrganListByIsInvolveChild(@RequestHeader("Authorization") String token, Boolean isInvolveChild) {
long organId = TokenParsingUtil.TokenParsing(token, "organId");
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
if (null == isInvolveChild) {
isInvolveChild = false;
}
List<ChSrvOrgan> chFndSrvModes = disableService.srvOrganList(organId, isInvolveChild);
List<ChSrvOrgan> chFndSrvModes = disableService.srvOrganList(String.valueOf(organId),srvOrganId, isInvolveChild);
return Result.success(chFndSrvModes);
}
......
......@@ -19,6 +19,7 @@ import com.hungraim.ltc.service.SrvOrganService;
import com.hungraim.ltc.util.FileUtils;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.TokenParsingUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
......@@ -53,9 +54,11 @@ public class SrvOrganController {
* @return 返回护理机构列表
*/
@GetMapping("/list")
public Result<Page<SrvOrganListVo>> getSrvOrganList(Integer pageNum, Integer pageSize, Long organId, Boolean isInvolveChild, String creditCode, String srvOrganName) {
public Result<Page<SrvOrganListVo>> getSrvOrganList(@RequestHeader("Authorization") String token,Integer pageNum,
Integer pageSize, Long organId, Boolean isInvolveChild, String creditCode, String srvOrganName) {
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
Page<SrvOrganListVo> page = new Page<>(pageNum, pageSize);
page = srvOrganService.getSrvOrganList(page, organId, isInvolveChild, creditCode, srvOrganName);
page = srvOrganService.getSrvOrganList(page, organId, isInvolveChild, creditCode, srvOrganName,srvOrganId);
return Result.success(page);
}
......@@ -150,9 +153,10 @@ public class SrvOrganController {
* @return 返回列表
*/
@GetMapping("/srvOrganEmpList")
public Result<Page<SrvOrganEmpListVo>> getSrvOrganEmpListVo(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, Long organId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum, Short isLock, Short empType) {
public Result<Page<SrvOrganEmpListVo>> getSrvOrganEmpListVo(@RequestHeader("Authorization") String token,@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize, Long organId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum, Short isLock, Short empType) {
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
Page<SrvOrganEmpListVo> page = new Page<>(pageNum, pageSize);
page = srvOrganEmpService.getSrvOrganEmpListVo(page, organId, isInvolveChild, empName, srvOrganName, certifNum, isLock, empType);
page = srvOrganEmpService.getSrvOrganEmpListVo(page, organId, isInvolveChild, empName, srvOrganName, certifNum, isLock, empType,srvOrganId);
return Result.success(page);
}
......@@ -274,9 +278,11 @@ public class SrvOrganController {
* @param empType 护理人员类型
*/
@GetMapping("/srvOrganExport")
public void srvOrganExport(Long organId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum,
public void srvOrganExport(@RequestHeader("Authorization") String token, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum,
Short isLock, Short empType,HttpServletResponse response){
Workbook workbook = srvOrganEmpService.srvOrganExport(organId, isInvolveChild, empName, srvOrganName, certifNum,
long organId = TokenParsingUtil.TokenParsing(token, "organId");
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
Workbook workbook = srvOrganEmpService.srvOrganExport(organId,srvOrganId, isInvolveChild, empName, srvOrganName, certifNum,
isLock, empType);
// 命名表格
String fileName = "srvOrgan.xlsx";
......
......@@ -28,9 +28,9 @@ public interface ChSrvOrganEmpMapper extends BaseMapper<ChSrvOrganEmp> {
* @param empType 护理人员类型
* @return 返回列表
*/
Page<SrvOrganEmpListVo> getSrvOrganEmpListVo(Page<SrvOrganEmpListVo> page, List<Long> organIds, String empName, String srvOrganName, String certifNum, Short isLock, Short empType);
Page<SrvOrganEmpListVo> getSrvOrganEmpListVo(Page<SrvOrganEmpListVo> page, List<Long> organIds, String empName, String srvOrganName, String certifNum, Short isLock, Short empType,Long srvOrganId);
List<SrvOrganEmpExportVo> getSrvOrganEmpExportList(List<Long> organIds, String empName, String srvOrganName, String certifNum, Short isLock, Short empType);
List<SrvOrganEmpExportVo> getSrvOrganEmpExportList(List<Long> organIds,Long srvOrganId, String empName, String srvOrganName, String certifNum, Short isLock, Short empType);
}
\ No newline at end of file
......@@ -29,5 +29,8 @@ public interface SrvOrganMapper extends BaseMapper<ChSrvOrgan> {
* @param srvOrganName 护理机构名称
* @return 返回护理机构列表
*/
Page<SrvOrganListVo> getSrvOrganList(Page<SrvOrganListVo> page, @Param("organIds") List<Long> organIds, @Param("creditCode") String creditCode, @Param("srvOrganName") String srvOrganName);
Page<SrvOrganListVo> getSrvOrganList(Page<SrvOrganListVo> page, @Param("organIds") List<Long> organIds,
@Param("creditCode") String creditCode,
@Param("srvOrganName") String srvOrganName,
@Param("srvOrganId") Long srvOrganId);
}
......@@ -51,7 +51,7 @@ public interface DisableService {
*/
List<ChFndDistrict> district(String districtLevel, String districtCode);
List<ChFndOrgan> fndOrganRoot();
List<ChFndOrgan> fndOrganRoot(long organId);
/**
* 查询所有服务方式
......@@ -64,7 +64,7 @@ public interface DisableService {
* @param organId 机构id
* @param isInvolveChild 是否包含子机构
*/
List<ChSrvOrgan> srvOrganList(String organId, Boolean isInvolveChild);
List<ChSrvOrgan> srvOrganList(String organId,Long srvOrganId, Boolean isInvolveChild);
/**
* 查询疾病类型
......@@ -109,7 +109,7 @@ public interface DisableService {
*
* @return 返回列表
*/
List<ChFndOrgan> fndAllOrgan();
List<ChFndOrgan> fndAllOrgan(long organId);
/**
* 失能人员信息变更表-新增
......
......@@ -24,7 +24,7 @@ public interface SrvOrganEmpService {
* @param empType 护理人员类型
* @return 返回列表
*/
Page<SrvOrganEmpListVo> getSrvOrganEmpListVo(Page<SrvOrganEmpListVo> page, Long organId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum, Short isLock, Short empType);
Page<SrvOrganEmpListVo> getSrvOrganEmpListVo(Page<SrvOrganEmpListVo> page, Long organId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum, Short isLock, Short empType,Long srvOrganId);
/**
* 修改护理人员的状态
......@@ -65,7 +65,7 @@ public interface SrvOrganEmpService {
*/
void saveOrUpdateSrvOrganEmp(SrvOrganEmpVo srvOrganEmpVo);
Workbook srvOrganExport(Long organId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum,
Workbook srvOrganExport(Long organId,Long srvOrganId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum,
Short isLock, Short empType);
Page<ChSrvTaskDetailVo> chSrvTaskDetailQuery(Page<ChSrvTaskDetailVo> page,Long empId);
......
......@@ -20,7 +20,7 @@ public interface SrvOrganService {
* @param srvOrganName 护理机构名称
* @return 返回护理机构列表
*/
Page<SrvOrganListVo> getSrvOrganList(Page<SrvOrganListVo> page, Long organId, Boolean isInvolveChild, String creditCode, String srvOrganName);
Page<SrvOrganListVo> getSrvOrganList(Page<SrvOrganListVo> page, Long organId, Boolean isInvolveChild, String creditCode, String srvOrganName,Long srvOrganId);
/**
* 获取所有服务机构等级
......
......@@ -311,10 +311,13 @@ public class DisableServiceImpl implements DisableService {
}
@Override
public List<ChFndOrgan> fndOrganRoot() {
public List<ChFndOrgan> fndOrganRoot(long organId) {
QueryWrapper<ChFndOrgan> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("IS_LEAF", "1");
queryWrapper.eq("STATUS", "1");
if(organId!=0){
queryWrapper.eq("ORGAN_ID", organId);
}
queryWrapper.and(wrapper -> wrapper.isNull("PARENT_ID").or().eq("PARENT_ID", ""));
return fndOrganMapper.selectList(queryWrapper);
}
......@@ -325,10 +328,19 @@ public class DisableServiceImpl implements DisableService {
}
@Override
public List<ChSrvOrgan> srvOrganList(String organId, Boolean isInvolveChild) {
public List<ChSrvOrgan> srvOrganList(String organId,Long srvOrganId, Boolean isInvolveChild) {
// zhangch 2021-11-04 修改查询条件 new QueryWrapper<ChSrvOrgan>().eq("organ_id", organId).eq("STATUS", (short) 0)
List<Long> organIds = organService.getOrganIds(Long.valueOf(organId), isInvolveChild);
return srvOrganMapper.selectList(new LambdaQueryWrapper<ChSrvOrgan>().eq(ChSrvOrgan::getStatus, (short) 0).in(ChSrvOrgan::getOrganId, organIds));
LambdaQueryWrapper<ChSrvOrgan> queryWrapper = new LambdaQueryWrapper<ChSrvOrgan>();
queryWrapper.eq(ChSrvOrgan::getStatus, (short) 0);
if(organIds.size() > 0){
queryWrapper.in(ChSrvOrgan::getOrganId, organIds);
}
if(srvOrganId!=0){
queryWrapper.in(ChSrvOrgan::getSrvOrganId, srvOrganId);
}
return srvOrganMapper.selectList(queryWrapper );
}
@Override
......@@ -388,10 +400,13 @@ public class DisableServiceImpl implements DisableService {
}
@Override
public List<ChFndOrgan> fndAllOrgan() {
public List<ChFndOrgan> fndAllOrgan(long organId) {
QueryWrapper<ChFndOrgan> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("IS_LEAF", "1");
queryWrapper.eq("STATUS", "1");
if(organId!=0){
queryWrapper.eq("ORGAN_ID", organId);
}
return fndOrganMapper.selectList(queryWrapper);
}
......
......@@ -25,7 +25,9 @@ public class OrganServiceImpl implements OrganService {
private void getOrganList(Long organId, List<Long> organIds) {
QueryWrapper<ChFndOrgan> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("STATUS", "1");
if(organId!=0){
queryWrapper.eq("PARENT_ID", organId);
}
List<ChFndOrgan> organs = fndOrganMapper.selectList(queryWrapper);
if (organs != null && organs.size() != 0) {
for (ChFndOrgan chFndOrgan : organs) {
......@@ -41,7 +43,7 @@ public class OrganServiceImpl implements OrganService {
@Override
public List<Long> getOrganIds(Long organId, Boolean isInvolveChild) {
List<Long> organIds = new ArrayList<>();
if (organId != null) {
if (organId != null && organId != 0) {
organIds.add(organId);
if (isInvolveChild) {
getOrganList(organId, organIds);
......
......@@ -62,9 +62,9 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
@Override
public Page<SrvOrganEmpListVo> getSrvOrganEmpListVo(Page<SrvOrganEmpListVo> page, Long organId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum, Short isLock, Short empType) {
public Page<SrvOrganEmpListVo> getSrvOrganEmpListVo(Page<SrvOrganEmpListVo> page, Long organId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum, Short isLock, Short empType,Long srvOrganId) {
List<Long> organIds = organService.getOrganIds(organId, isInvolveChild);
return chSrvOrganEmpMapper.getSrvOrganEmpListVo(page, organIds, empName, srvOrganName, certifNum, isLock, empType);
return chSrvOrganEmpMapper.getSrvOrganEmpListVo(page, organIds, empName, srvOrganName, certifNum, isLock, empType,srvOrganId);
}
@Override
......@@ -141,10 +141,10 @@ public class SrvOrganEmpServiceImpl implements SrvOrganEmpService {
@Override
public Workbook srvOrganExport(Long organId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum,
public Workbook srvOrganExport(Long organId,Long srvOrganId, Boolean isInvolveChild, String empName, String srvOrganName, String certifNum,
Short isLock, Short empType) {
List<Long> organIds = organService.getOrganIds(organId, isInvolveChild);
List<SrvOrganEmpExportVo> srvOrganEmpExportList = chSrvOrganEmpMapper.getSrvOrganEmpExportList(organIds, empName, srvOrganName, certifNum, isLock, empType);
List<SrvOrganEmpExportVo> srvOrganEmpExportList = chSrvOrganEmpMapper.getSrvOrganEmpExportList(organIds,srvOrganId, empName, srvOrganName, certifNum, isLock, empType);
for (SrvOrganEmpExportVo record : srvOrganEmpExportList) {
StringBuilder stringBuilder = new StringBuilder();
......
......@@ -50,9 +50,9 @@ public class SrvOrganServiceImpl implements SrvOrganService {
@Override
public Page<SrvOrganListVo> getSrvOrganList(Page<SrvOrganListVo> page, Long organId, Boolean isInvolveChild, String creditCode, String srvOrganName) {
public Page<SrvOrganListVo> getSrvOrganList(Page<SrvOrganListVo> page, Long organId, Boolean isInvolveChild, String creditCode, String srvOrganName,Long srvOrganId) {
List<Long> organIds = organService.getOrganIds(organId, isInvolveChild);
Page<SrvOrganListVo> srvOrganList = srvOrganMapper.getSrvOrganList(page, organIds, creditCode, srvOrganName);
Page<SrvOrganListVo> srvOrganList = srvOrganMapper.getSrvOrganList(page, organIds, creditCode, srvOrganName,srvOrganId);
List<SrvOrganListVo> records = srvOrganList.getRecords();
if (records != null && records.size() > 0) {
for (SrvOrganListVo srvOrganListVo : records) {
......
......@@ -82,6 +82,9 @@
<if test="empType != null">
AND T1.EMP_TYPE = #{empType}
</if>
<if test="srvOrganId != null and srvOrganId != 0">
AND T4.SRV_ORGAN_ID = #{srvOrganId}
</if>
</where>
ORDER BY T1.EFF_TIME DESC
</select>
......@@ -136,6 +139,9 @@
<if test="empType != null">
AND T1.EMP_TYPE = #{empType}
</if>
<if test="srvOrganId != null and srvOrganId != 0" >
AND T4.SRV_ORGAN_ID = #{srvOrganId}
</if>
</where>
ORDER BY T1.EFF_TIME DESC
</select>
......
......@@ -52,5 +52,8 @@
<if test="srvOrganName != null and srvOrganName != ''">
AND T1.SRV_ORGAN_NAME LIKE CONCAT('%',CONCAT(#{srvOrganName},'%'))
</if>
<if test="srvOrganId != null and srvOrganId != ''and srvOrganId!=0">
AND T1.SRV_ORGAN_ID = #{srvOrganId}
</if>
</select>
</mapper>
\ No newline at end of file
......@@ -155,7 +155,7 @@ public class AuthorizationServerConfiguration extends AuthorizationServerConfigu
public TokenEnhancer tokenEnhancer() {
return (accessToken, authentication) -> {
UserLoginInfoVO user = (UserLoginInfoVO) authentication.getUserAuthentication().getPrincipal();
Map<String, Object> map = new HashMap<>(4);
Map<String, Object> map = new HashMap<>(6);
map.put("name", user.getName());
map.put("avatar", user.getAvatar());
map.put("userId", user.getUserId());
......
......@@ -63,6 +63,14 @@
<scope>compile</scope>
</dependency>
<!--jwt-->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-jwt</artifactId>
<version>1.0.9.RELEASE</version>
<scope>compile</scope>
</dependency>
<!--Excel导入导出-->
<dependency>
<groupId>cn.afterturn</groupId>
......
package com.hungraim.ltc.util;
import com.alibaba.fastjson.JSONObject;
import com.hungraim.ltc.constant.AuthConstants;
import org.springframework.security.jwt.JwtHelper;
public class TokenParsingUtil {
public static Integer TokenParsing(String token, String id){
//解析token
String subToken = token.substring(AuthConstants.JWT_PREFIX.length());
String claims = JwtHelper.decode(subToken).getClaims();
Integer rid = (Integer) JSONObject.parseObject(claims).get(id);
return rid;
}
}
......@@ -11,13 +11,11 @@ import com.hungraim.ltc.pojo.vo.disable.SrvModeVo;
import com.hungraim.ltc.pojo.vo.governance.OrganProjectVO;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.TokenParsingUtil;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
......@@ -43,8 +41,11 @@ public class NursingServiceItemsController {
* @param status 状态
*/
@RequestMapping("/organProjectList")
public Result<Page<OrganProjectVO>> organProjectList(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize,
public Result<Page<OrganProjectVO>> organProjectList(@RequestHeader("Authorization") String token,
@RequestParam(defaultValue = "1") Integer pageNum,
@RequestParam(defaultValue = "10") Integer pageSize,
String organIds, String name, String status) {
long organId = TokenParsingUtil.TokenParsing(token, "organId");
Page<OrganProjectVO> page = new Page<>(pageNum, pageSize);
page = nursingServiceItemsService.organProjectList(page, organIds, name, status);
return Result.success(page);
......
......@@ -11,6 +11,7 @@ import com.hungraim.ltc.pojo.vo.governance.ProgramSetAndProjectVo;
import com.hungraim.ltc.pojo.vo.governance.SvrSendListVo;
import com.hungraim.ltc.util.Result;
import com.hungraim.ltc.util.ResultCode;
import com.hungraim.ltc.util.TokenParsingUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
......@@ -47,7 +48,8 @@ public class SrvProgramController {
* @return 返回列表
*/
@RequestMapping("/programList")
public Result getProgramList(Long srvOrganId, String realName, String realTel, String programStatus, Integer pageNum, Integer pageSize) {
public Result getProgramList(@RequestHeader("Authorization") String token, String realName, String realTel, String programStatus, Integer pageNum, Integer pageSize) {
long srvOrganId = TokenParsingUtil.TokenParsing(token, "srvOrganId");
if (pageNum == null || pageNum < 1) {
return Result.failed(ResultCode.REQUEST_PARAM_ERROR);
}
......
......@@ -53,7 +53,7 @@
INNER JOIN CH_SRV_ORGAN T2 ON T1.SRV_ORGAN_ID = T2.SRV_ORGAN_ID
INNER JOIN CH_DISABLE_INFO T3 ON T1.DISAB_INFO_ID = T3.DISAB_INFO_ID
<where>
<if test="srvOrganId != null">
<if test="srvOrganId != null and srvOrganId != 0">
T1.SRV_ORGAN_ID = #{srvOrganId}
</if>
<if test="realName != null and realName != ''">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment