Browse Source

Merge branch 'dev' of liuwenbin/patient-co-management into dev

yeshijie 7 years ago
parent
commit
4de88e63c4

+ 41 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/RoleService.java

@ -68,7 +68,21 @@ public class RoleService extends TokenService {
    public List<Map<String, String>> getUserRoleAndArea(String user) {
        List<Map<String, String>> re = new ArrayList<>();
        List<DoctorRole> roleList = doctorRoleDao.findUserRole(user);
//        for(DoctorRole one:roleList){
//            int level = roleConverse(one.getCode());
//            tempList = temp.get(level);
//            if(tempList==null){
//                tempList=new ArrayList<>();
//            }
//            tempList.add(one.get("roleCode")+"");
//            temp.put(level,tempList);
//        }
        int resultLevel = 5;
        for (DoctorRole one : roleList) {
            if(resultLevel>roleConverse(one.getCode())){
                resultLevel=roleConverse(one.getCode());
            }
        }
        if (roleList != null && roleList.size() > 0) {
            //遍历角色
            for (DoctorRole role : roleList) {
@ -128,10 +142,36 @@ public class RoleService extends TokenService {
                    areaString = areaString.substring(0, areaString.length() - 1);
                }
                map.put("areas", areaString);
                map.put("level",roleConverse(role.getCode())+"");
                if(resultLevel==roleConverse(role.getCode())){
                    map.put("isManage", "1");
                }else{
                    map.put("isManage", "0");
                }
                re.add(map);
            }
        }
        return re;
    }
    /**
     * 角色code转成角色级别
     * @param roleCode 角色code
     * @return 1、省级,2、市级,3、区级,4、机构
     */
    public Integer roleConverse(String roleCode){
        if(roleCode.length()==6){
            if("0".equals(roleCode.substring(3,4))){
                return 1;
            }else if("00".equals(roleCode.substring(4))){
                return 2;
            }else{
                return 3;
            }
        }else{
            return 3;
        }
    }
}

+ 7 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.service.jimeiJkEdu;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.JSONPObject;
import com.yihu.edu.entity.RoleWithAuthorityCheck;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.es.entity.RoleVo;
@ -778,7 +779,7 @@ public class JMJkEduArticleService extends BaseService {
     */
    public void saveArticle(String userCode,String articleTitle,String articleType,Integer	articlelevel,String	secondLevelCategoryId,String image,
                            String	secondLevelCategoryName,String firstLevelCategoryId,String firstLevelCategoryName,String content,String operatorRoleCode,
                            String opertorRoleLevel,Integer userScope) throws Exception {
                            String opertorRoleLevel,Integer userScope,String articleId) throws Exception {
        image = commonUtil.copyTempImage(image);
        Integer isAuthentication = 0;
@ -792,7 +793,7 @@ public class JMJkEduArticleService extends BaseService {
        }
        thirdJkEduArticleService.saveArticle(userCode,articleTitle,articleType,articlelevel,secondLevelCategoryId,image,
                secondLevelCategoryName,firstLevelCategoryId,firstLevelCategoryName,content,operatorRoleCode,opertorRoleLevel,
                userScope,isAuthentication);
                userScope,isAuthentication,articleId);
    }
    /**
@ -808,18 +809,18 @@ public class JMJkEduArticleService extends BaseService {
     * @param currentUserRoleLevel
     * @throws Exception
     */
    public JSONArray queryArticlePcList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,String articlelevel,String articleTitle,
                                   String userCode,String currentUserRole,String currentUserRoleLevel,String isAuthentication,boolean isMyArticle) throws Exception{
    public JSONObject queryArticlePcList(String firstLevelCategoryId, String secondLevelCategoryId, String insertTimeStart, String insertTimeEnd, String articlelevel, String articleTitle,
                                          String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize) throws Exception{
//        Doctor doctor = doctorDao.findByCode(userCode);
//        boolean isManage = false;
//        if(doctor.getLevel()==10){
//            isManage = true;
//        }
        if(!isMyArticle){
        if(isMyArticle==null||(isMyArticle!=null&&!isMyArticle)){
            userCode = null;
        }
        return thirdJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,
                articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel);
                articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize);
    }
    /**

+ 10 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java

@ -376,7 +376,7 @@ public class ThirdJkEduArticleService extends BaseService {
     */
    public void saveArticle(String userCode,String articleTitle,String articleType,Integer	articlelevel,String	secondLevelCategoryId,String newUrl,
                                 String	secondLevelCategoryName,String firstLevelCategoryId,String firstLevelCategoryName,String content,
                                 String operatorRoleCode,String opertorRoleLevel,Integer userScope,Integer isAuthentication) throws Exception {
                                 String operatorRoleCode,String opertorRoleLevel,Integer userScope,Integer isAuthentication,String articleId) throws Exception {
        String response = "";
        JSONObject json = null;
@ -389,6 +389,7 @@ public class ThirdJkEduArticleService extends BaseService {
            String	orgId = doctor.getHospital();//组织
            String	userName = doctor.getName();//登录名称
            JSONObject param = new JSONObject();
            param.put("articleId", articleId);
            param.put("userCode", userCode);
            param.put("orgName", orgName);
            param.put("deptName", deptName);
@ -440,8 +441,8 @@ public class ThirdJkEduArticleService extends BaseService {
     * @return
     * @throws Exception
     */
    public JSONArray queryArticlePcList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,String articlelevel,
                                        String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel) throws Exception {
    public JSONObject queryArticlePcList(String firstLevelCategoryId,String secondLevelCategoryId,String insertTimeStart,String insertTimeEnd,String articlelevel,
                                        String articleTitle,String userCode,String isAuthentication,String currentUserRole,String currentUserRoleLevel,Integer page,Integer pageSize) throws Exception {
        String response = "";
        JSONObject json = null;
@ -457,13 +458,15 @@ public class ThirdJkEduArticleService extends BaseService {
            param.put("isAuthentication", isAuthentication);
            param.put("currentUserRole", currentUserRole);
            param.put("currentUserRoleLevel", currentUserRoleLevel);
            param.put("page", page+"");
            param.put("pageSize", pageSize+"");
            response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(queryArticlePcList, param.toString(), "1"));
            json = JSON.parseObject(response);
        } catch (Exception e) {
            e.printStackTrace();
        }
        if ("10000".equals(json.getString("Code"))) {
            return json.getJSONArray("Result");
            return json;
        } else {
            throw new Exception(json.getString("Message"));
        }
@ -504,12 +507,14 @@ public class ThirdJkEduArticleService extends BaseService {
     * @param categoryLevel 是    获取类别:1、一级类别 2、二级类别
     * @return
     */
    public JSONArray getCategoryList(String categoryLevel) throws Exception {
    public JSONArray getCategoryList(Integer categoryLevel,String firstlevelId,String secondLevelId) throws Exception {
        JSONArray re = new JSONArray();
        JSONObject json = null;
        try {
            JSONObject param = new JSONObject();
            param.put("categoryLevel", categoryLevel);
            param.put("firstlevelId", firstlevelId);
            param.put("secondLevelId", secondLevelId);
//            param.put("userId", userId);
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getCategoryList, param.toString(), "1"));
            json = JSON.parseObject(response);

+ 7 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/LoginController.java

@ -247,6 +247,13 @@ public class LoginController extends BaseController {
                    //获取医生角色和区域权限
                    List<Map<String, String>> roleMap = roleService.getUserRoleAndArea(doctor.getCode());
                    map.put("userRole", roleMap);
                    //医生当前登录的角色
                    for(Map<String, String> one:roleMap){
                        if("1".equals(one.get("isManage"))){
                            map.put("currentUserRole", one);
                            continue;
                        }
                    }
                    if ("10" .equals(doctor.getLevel()) && roleMap.size() == 0) {
                        errorMessage = "改用户没有管理员权限";
                        loginLog.setErrorMessage(errorMessage);

+ 34 - 21
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java

@ -1,8 +1,10 @@
package com.yihu.wlyy.web.doctor.jimeiJkEduPC;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -11,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.Iterator;
/**
 * Created by Trick on 2017/11/14.
 */
@ -21,10 +25,14 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    @Autowired
    private JMJkEduArticleService jmJkEduArticleService;
    @Autowired
    private ThirdJkEduArticleService thirdJkEduArticleService;
    @RequestMapping(value = "saveArticle", method = RequestMethod.POST)
    @ApiOperation("添加文章")
    public  String saveArticle(@ApiParam(name = "articleTitle", value = "文章标题")
    public  String saveArticle(@ApiParam(name = "articleId", value = "文章Id")
                               @RequestParam(value = "articleId", required = true) String articleId,
                               @ApiParam(name = "articleTitle", value = "文章标题")
                               @RequestParam(value = "articleTitle", required = true) String articleTitle,
                               @ApiParam(name = "articleType", value = "文章类型")
                               @RequestParam(value = "articleType", required = true) String articleType,
@ -42,16 +50,16 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                               @RequestParam(value = "content", required = true) String content,
                               @ApiParam(name = "imageUrl", value = "文章封面图片地址")
                               @RequestParam(value = "imageUrl", required = true) String imageUrl,
                               @ApiParam(name = "operatorRoleCode", value = "操作人角色code")
                               @RequestParam(value = "operatorRoleCode", required = true) String operatorRoleCode,
                               @ApiParam(name = "opertorRoleLevel", value = "操作人角色级别")
                               @RequestParam(value = "opertorRoleLevel", required = true) String opertorRoleLevel,
//                               @ApiParam(name = "operatorRoleCode", value = "操作人角色code")
//                               @RequestParam(value = "operatorRoleCode", required = true) String operatorRoleCode,
//                               @ApiParam(name = "opertorRoleLevel", value = "操作人角色级别")
//                               @RequestParam(value = "opertorRoleLevel", required = true) String opertorRoleLevel,
                               @ApiParam(name = "userScope", value = "使用范围(1、全市使用,2、全区使用,3、全社区使用)")
                               @RequestParam(value = "userScope", required = true) Integer userScope){
        try {
            jmJkEduArticleService.saveArticle(getUID(),articleTitle,articleType,articlelevel,secondLevelCategoryId,imageUrl,
                    secondLevelCategoryName,firstLevelCategoryId,firstLevelCategoryName,content,operatorRoleCode,opertorRoleLevel,userScope);
                    secondLevelCategoryName,firstLevelCategoryId,firstLevelCategoryName,content,getCurrentRoleCode(),getCurrentRoleLevel(),userScope,articleId);
            return success("添加成功!");
        }catch (Exception e){
            e.printStackTrace();
@ -67,8 +75,6 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
     * @param insertTimeEnd
     * @param articlelevel
     * @param articleTitle
     * @param currentUserRole
     * @param currentUserRoleLevel
     * @return
     */
    @RequestMapping(value = "queryArticlePcList", method = RequestMethod.GET)
@ -85,18 +91,24 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                                      @RequestParam(value = "articlelevel", required = false) String articlelevel,
                                      @ApiParam(name = "articleTitle", value = "文章标题关键字")
                                      @RequestParam(value = "articleTitle", required = false) String articleTitle,
                                      @ApiParam(name = "currentUserRole", value = "当前登录的角色")
                                      @RequestParam(value = "currentUserRole", required = true) String currentUserRole,
                                      @ApiParam(name = "currentUserRoleLevel", value = "当前登录的角色级别")
                                      @RequestParam(value = "currentUserRoleLevel", required = true )String currentUserRoleLevel,
                                      @ApiParam(name = "isAuthentication", value = "是否有权限")
//                                      @ApiParam(name = "currentUserRole", value = "当前登录的角色")
//                                      @RequestParam(value = "currentUserRole", required = true) String currentUserRole,
//                                      @ApiParam(name = "currentUserRoleLevel", value = "当前登录的角色级别")
//                                      @RequestParam(value = "currentUserRoleLevel", required = true )String currentUserRoleLevel,
                                      @ApiParam(name = "isAuthentication", value = "是否认证")
                                      @RequestParam(value = "isAuthentication", required = false) String isAuthentication,
                                      @ApiParam(name = "isMyArticle", value = "是否过滤我的文章")
                                      @RequestParam(value = "isMyArticle", required = false) Boolean isMyArticle){
                                      @RequestParam(value = "isMyArticle", required = false) Boolean isMyArticle,
                                      @ApiParam(name = "iDisplayStart", value = "当前页")
                                      @RequestParam(value = "iDisplayStart", required = true) Integer page,
                                      @ApiParam(name = "iDisplayLength", value = "是否过滤我的文章")
                                      @RequestParam(value = "iDisplayLength", required = true) Integer pageSize){
        try {
            JSONArray response = jmJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,articleTitle,
                    getUID(),currentUserRole,currentUserRoleLevel,isAuthentication,isMyArticle);
            JSONObject response = jmJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,articleTitle,
                    getUID(),getCurrentRoleCode(),getCurrentRoleLevel(),isAuthentication,isMyArticle,page,pageSize);
            return write(200,"查询成功!","data",response);
        } catch (Exception e){
            e.printStackTrace();
@ -106,10 +118,11 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    @RequestMapping(value = "saveOrUpdateArticleQR", method = RequestMethod.POST)
    @ApiOperation("保存或更新认证标识")
    public  String saveOrUpdateArticleQR(@ApiParam(name = "currentRoleLevel", value = "当前登录角色的级别")
                                         @RequestParam(value = "currentRoleLevel", required = true) String currentRoleLevel,
                                         @ApiParam(name = "currentRoleCode", value = "当前登录角色的code")
                                         @RequestParam(value = "currentRoleCode", required = true) String currentRoleCode,
    public  String saveOrUpdateArticleQR(
//                                        @ApiParam(name = "currentRoleLevel", value = "当前登录角色的级别")
//                                         @RequestParam(value = "currentRoleLevel", required = true) String currentRoleLevel,
//                                         @ApiParam(name = "currentRoleCode", value = "当前登录角色的code")
//                                         @RequestParam(value = "currentRoleCode", required = true) String currentRoleCode,
                                         @ApiParam(name = "position", value = "位置")
                                         @RequestParam(value = "position", required = false) Integer position,
                                         @ApiParam(name = "imgUrl", value = "二维码图片地址")
@ -118,7 +131,7 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                                         @RequestParam(value = "id", required = false) Integer id){
        try{
            jmJkEduArticleService.saveOrUpdateArticleQR(currentRoleLevel,currentRoleCode,position,imgUrl,getUID(),id);
            jmJkEduArticleService.saveOrUpdateArticleQR(getCurrentRoleLevel(),getCurrentRoleCode(),position,imgUrl,getUID(),id);
            return success("保存成功!");
        } catch (Exception e){
            e.printStackTrace();

+ 29 - 12
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java

@ -193,7 +193,7 @@ public class ThirdJkEduArticleController extends BaseController {
    /*************************************************** Category *****************************************************/
    @RequestMapping(value = "addCategory",method = RequestMethod.GET)
    @RequestMapping(value = "addCategory",method = RequestMethod.POST)
    @ApiOperation("添加二级分类-仅向市级管理员开放编辑权限")
    public String addCategory(@ApiParam(name = "categoryName", value = "文章分类名称")
                                           @RequestParam(value = "categoryName", required = true) String categoryName,
@ -202,12 +202,13 @@ public class ThirdJkEduArticleController extends BaseController {
                                           @ApiParam(name = "firstlevelId", value = "一级类别ID")
                                           @RequestParam(value = "firstlevelId", required = true ) String firstlevelId,
                                           @ApiParam(name = "secondLevelId", value = "二级类别ID")
                                           @RequestParam(value = "secondLevelId", required = true ) String secondLevelId,
                                           @ApiParam(name = "currentRoleCode", value = "当前登录角色")
                                           @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode){
                                           @RequestParam(value = "secondLevelId", required = false ) String secondLevelId
//                                           @ApiParam(name = "currentRoleCode", value = "当前登录角色")
//                                           @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode
    ){
        try {
            thirdJkEduArticleService.addCategory(categoryName,categoryLevel,firstlevelId,secondLevelId,getUID(),currentRoleCode);
            thirdJkEduArticleService.addCategory(categoryName,categoryLevel,firstlevelId,secondLevelId,getUID(),getCurrentRoleCode());
            return success("添加成功!");
        }catch (Exception e){
            e.printStackTrace();
@ -222,12 +223,12 @@ public class ThirdJkEduArticleController extends BaseController {
                              @ApiParam(name = "categoryName", value = "文章分类名称")
                              @RequestParam(value = "categoryName", required = true ) String categoryName,
                              @ApiParam(name = "categoryState", value = "类别状态1、正常、2删除")
                              @RequestParam(value = "categoryState", required = true ) Integer categoryState,
                              @ApiParam(name = "currentRoleCode", value = "当前登录角色")
                              @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode){
                              @RequestParam(value = "categoryState", required = false ) Integer categoryState){
//                              @ApiParam(name = "currentRoleCode", value = "当前登录角色")
//                              @RequestParam(value = "currentRoleCode", required = true ) String currentRoleCode){
        try {
            thirdJkEduArticleService.updateCategory(categoryId,categoryName,categoryState,getUID(),currentRoleCode);
            thirdJkEduArticleService.updateCategory(categoryId,categoryName,categoryState,getUID(),getCurrentRoleCode());
            return success("更新成功!");
        }catch (Exception e){
            e.printStackTrace();
@ -237,10 +238,14 @@ public class ThirdJkEduArticleController extends BaseController {
    @RequestMapping(value = "getCategoryList",method = RequestMethod.GET)
    @ApiOperation("获取文章类别")
    public String getCategoryList(@ApiParam(name = "categoryLevel", value = "获取类别:1、一级类别 2、二级类别",defaultValue = "1")
                                  @RequestParam(value = "categoryLevel", required = false) String categoryLevel){
    public String getCategoryList(@ApiParam(name = "categoryLevel", value = "获取类别:1、一级类别 2、二级类别")
                                  @RequestParam(value = "categoryLevel", required = false) Integer categoryLevel,
                                  @ApiParam(name = "firstlevelId", value = "一级类别Id")
                                  @RequestParam(value = "firstlevelId", required = false) String firstlevelId,
                                  @ApiParam(name = "secondLevelId", value = "二级类别Id")
                                  @RequestParam(value = "secondLevelId", required = false) String secondLevelId){
        try {
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCategoryList(categoryLevel);
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCategoryList(categoryLevel,firstlevelId,secondLevelId);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -262,4 +267,16 @@ public class ThirdJkEduArticleController extends BaseController {
            return error(-1,"查询失败!");
        }
    }
    @RequestMapping(value = "getArticleQRCode",method = RequestMethod.GET)
    @ApiOperation("获取认证标识")
    public String getArticleQRCode(){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticleQRCode(getCurrentRoleLevel(), getCurrentRoleCode());
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
}