|  | @ -76,7 +76,7 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  |      * @return
 | 
	
		
			
				|  |  |      * @throws Exception
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public List<HealthEduArticlePatientModel> pushArticleList(int page, int pagesize, String sendCode,  String firstLevelCategoryId,Integer myArticle,Integer sendType) throws Exception {
 | 
	
		
			
				|  |  |     public List<HealthEduArticlePatientModel> pushArticleList(int page, int pagesize, String sendCode,  String firstLevelCategoryId,Integer myArticle,Integer sendType,String currentUserRole, String currentUserRoleLevel) throws Exception {
 | 
	
		
			
				|  |  |         pagesize = page * pagesize;
 | 
	
		
			
				|  |  |         page = (page - 1) * pagesize;
 | 
	
		
			
				|  |  | //        if(loginType==2){
 | 
	
	
		
			
				|  | @ -99,6 +99,9 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  |         if(myArticle==1){
 | 
	
		
			
				|  |  |             sql2.append("and operatorId="+sendCode);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         sql2.append("and currentUserRole="+currentUserRole);
 | 
	
		
			
				|  |  |         sql2.append("and currentUserRoleLevel="+currentUserRoleLevel);
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         sql2.append("  order by createTime limit " + page + "," + pagesize);
 | 
	
		
			
				|  |  |         List<com.yihu.es.entity.HealthEduArticlePatient> esList = elasticsearchUtil.excute(sql2.toString(), com.yihu.es.entity.HealthEduArticlePatient.class, esIndex, esType);
 | 
	
		
			
				|  |  |         Map<String, HealthEduArticlePatientModel> result = new HashMap<>();
 | 
	
	
		
			
				|  | @ -204,8 +207,120 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //    }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //    /**
 | 
	
		
			
				|  |  | //     * 保存发送信息
 | 
	
		
			
				|  |  | //     *
 | 
	
		
			
				|  |  | //     * @param patientSet  患者set集和
 | 
	
		
			
				|  |  | //     * @param sendCode    发送人code、
 | 
	
		
			
				|  |  | //     * @param sendMessage 发送人携带的信息
 | 
	
		
			
				|  |  | //     * @param teamId      发送人所属团队
 | 
	
		
			
				|  |  | //     * @param articleId   文章列表
 | 
	
		
			
				|  |  | //     */
 | 
	
		
			
				|  |  | //    @Transactional
 | 
	
		
			
				|  |  | //    public HealthEduArticlePatient saveArticle(Set<String> patientSet,
 | 
	
		
			
				|  |  | //                                                  String sendCode,
 | 
	
		
			
				|  |  | ////                                                  String sendName,
 | 
	
		
			
				|  |  | //                                                  Integer sendType,
 | 
	
		
			
				|  |  | //                                                  String sendMessage,
 | 
	
		
			
				|  |  | //                                                  Long teamId,
 | 
	
		
			
				|  |  | //                                                  String articleId,
 | 
	
		
			
				|  |  | //                                                  String leaveWords) throws Exception {
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        String batchNo = UUID.randomUUID().toString();
 | 
	
		
			
				|  |  | //        List<Patient> patientList = new ArrayList<>();
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        for (String patient : patientSet) {
 | 
	
		
			
				|  |  | //            patientList.add(new Patient(patient));
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        HealthEduArticlePatient healthEduArticlePatient = new HealthEduArticlePatient();
 | 
	
		
			
				|  |  | //        //1、医生,2、卫计委(管理员)
 | 
	
		
			
				|  |  | //        //如果是卫计委得区别角色
 | 
	
		
			
				|  |  | //        Doctor doctor = doctorDao.findByCode(sendCode);
 | 
	
		
			
				|  |  | //        String sendName = doctor.getName();
 | 
	
		
			
				|  |  | //        //管理员
 | 
	
		
			
				|  |  | //        Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(sendCode);
 | 
	
		
			
				|  |  | //        Integer level = (Integer)resultMap.get("level");
 | 
	
		
			
				|  |  | //        List<String> roleList = (List<String>)resultMap.get("roleList");
 | 
	
		
			
				|  |  | //        if(doctor.getLevel()==10&&sendType==2){
 | 
	
		
			
				|  |  | //            String resultSql ="";
 | 
	
		
			
				|  |  | //            String whereSql ="";
 | 
	
		
			
				|  |  | //            String temp = "";
 | 
	
		
			
				|  |  | //            for(String one :roleList){
 | 
	
		
			
				|  |  | //                temp+=",'"+one+"'";
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | //            if(!StringUtils.isEmpty(temp)){
 | 
	
		
			
				|  |  | //                temp=temp.substring(1);
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | //            switch (level){
 | 
	
		
			
				|  |  | //                case 1:{resultSql +=" DISTINCT (province_name) as name";
 | 
	
		
			
				|  |  | //                    whereSql+=" and province in ("+temp+")";break;}
 | 
	
		
			
				|  |  | //                case 2:{resultSql +=" DISTINCT (city_name) as name";
 | 
	
		
			
				|  |  | //                    whereSql+=" and city in ("+temp+")";break;}
 | 
	
		
			
				|  |  | //                case 3:{resultSql +=" DISTINCT (town_name) as name";
 | 
	
		
			
				|  |  | //                    whereSql+=" and town in ("+temp+")";break;}
 | 
	
		
			
				|  |  | //                case 4:{resultSql +=" DISTINCT (name) as name";
 | 
	
		
			
				|  |  | //                    whereSql+=" and code in ("+temp+")";break;}
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | //            String sql = "select "+resultSql+" from dm_hospital  where level=2 "+whereSql ;
 | 
	
		
			
				|  |  | //            List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | //            temp = "";
 | 
	
		
			
				|  |  | //            for(Map<String, Object> one :returnList){
 | 
	
		
			
				|  |  | //                temp +=","+one.get("name");
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | //            sendName = StringUtils.isEmpty(temp)?"":temp.substring(1);
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        List<RoleVo> roleVoLists= new ArrayList<>();
 | 
	
		
			
				|  |  | //        for(String one:roleList){
 | 
	
		
			
				|  |  | //            RoleVo roleVo = new RoleVo();
 | 
	
		
			
				|  |  | //            roleVo.setCode(one);
 | 
	
		
			
				|  |  | //            roleVoLists.add(roleVo);
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setRoleList(roleVoLists);
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setDoctorCode(sendCode);
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setSendName(sendName);
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setSendType(2);
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setAdminTeamCode(teamId);
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setLeaveWords(leaveWords);
 | 
	
		
			
				|  |  | //        if (doctor != null) {
 | 
	
		
			
				|  |  | //            healthEduArticlePatient.setDoctorName(doctor.getName());
 | 
	
		
			
				|  |  | //            healthEduArticlePatient.setHospital(doctor.getHospital());
 | 
	
		
			
				|  |  | //            healthEduArticlePatient.setHospitalName(doctor.getHospitalName());
 | 
	
		
			
				|  |  | //            healthEduArticlePatient.setTown(doctor.getTown());
 | 
	
		
			
				|  |  | //            healthEduArticlePatient.setTownName(doctor.getTownName());
 | 
	
		
			
				|  |  | //            healthEduArticlePatient.setSendLevel(doctor.getLevel() != null ? String.valueOf(doctor.getLevel()) : "");
 | 
	
		
			
				|  |  | //            healthEduArticlePatient.setSendPic(doctor.getPhoto());
 | 
	
		
			
				|  |  | //            healthEduArticlePatient.setSendSex(doctor.getSex() != null ? String.valueOf(doctor.getSex()) : "");
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setBatchNo(batchNo);
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setCreateTime(new Date());
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        //通过文章id 获取文章详情
 | 
	
		
			
				|  |  | //        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setArticleId(article.get("articleId") + "");
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setAttachedTitle(article.get("articleTitle") + "");
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setAttachedPic(article.get("articleCover") + "");
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setAttachedContent(article.get("articleContent") + "");
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setAttachedMessage(sendMessage);
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setArticleType(article.get("articleType") + "");
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setLevel(article.get("articlelevel") + "");
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setLevel1Type(article.get("firstLevelCategoryId") + "");
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setLevel2Type(article.get("secondLevelCategoryId") + "");
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setType("1");//文章
 | 
	
		
			
				|  |  | ////        healthEduArticlePatient.setArticleUrl(articleBaseUrl+"JkEduWeb/web/jkEdu/articleDetail.html?behavior=4&articleId="+articleId+"&userId="+);
 | 
	
		
			
				|  |  | //        healthEduArticlePatient.setPatients(patientList);
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        //保存到ES中
 | 
	
		
			
				|  |  | //        elastricSearchSave.save(healthEduArticlePatient, esIndex, esType);
 | 
	
		
			
				|  |  | //        return healthEduArticlePatient;
 | 
	
		
			
				|  |  | //    }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
		
			
				|  |  |      * 保存发送信息
 | 
	
		
			
				|  |  |      * 保存PC端发送信息
 | 
	
		
			
				|  |  |      *
 | 
	
		
			
				|  |  |      * @param patientSet  患者set集和
 | 
	
		
			
				|  |  |      * @param sendCode    发送人code、
 | 
	
	
		
			
				|  | @ -214,14 +329,16 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  |      * @param articleId   文章列表
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     @Transactional
 | 
	
		
			
				|  |  |     public HealthEduArticlePatient saveArticle(Set<String> patientSet,
 | 
	
		
			
				|  |  |                                                   String sendCode,
 | 
	
		
			
				|  |  |     public HealthEduArticlePatient savePCPushArticle(Set<String> patientSet,
 | 
	
		
			
				|  |  |                                                      String sendCode,
 | 
	
		
			
				|  |  | //                                                  String sendName,
 | 
	
		
			
				|  |  |                                                   Integer sendType,
 | 
	
		
			
				|  |  |                                                   String sendMessage,
 | 
	
		
			
				|  |  |                                                   Long teamId,
 | 
	
		
			
				|  |  |                                                   String articleId,
 | 
	
		
			
				|  |  |                                                   String leaveWords) throws Exception {
 | 
	
		
			
				|  |  |                                                      Integer sendType,
 | 
	
		
			
				|  |  |                                                      String sendMessage,
 | 
	
		
			
				|  |  |                                                      Long teamId,
 | 
	
		
			
				|  |  |                                                      String articleId,
 | 
	
		
			
				|  |  |                                                      String leaveWords,
 | 
	
		
			
				|  |  |                                                      String currentUserRoleCode,
 | 
	
		
			
				|  |  |                                                      String currentUserRoleLevel) throws Exception {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         String batchNo = UUID.randomUUID().toString();
 | 
	
	
		
			
				|  | @ -231,53 +348,45 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  |             patientList.add(new Patient(patient));
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         HealthEduArticlePatient healthEduArticlePatient = new HealthEduArticlePatient();
 | 
	
		
			
				|  |  |         //1、医生,2、卫计委(管理员)
 | 
	
		
			
				|  |  |         //如果是卫计委得区别角色
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Doctor doctor = doctorDao.findByCode(sendCode);
 | 
	
		
			
				|  |  |         String sendName = doctor.getName();
 | 
	
		
			
				|  |  |         //管理员
 | 
	
		
			
				|  |  |         Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(sendCode);
 | 
	
		
			
				|  |  |         Integer level = (Integer)resultMap.get("level");
 | 
	
		
			
				|  |  |         List<String> roleList = (List<String>)resultMap.get("roleList");
 | 
	
		
			
				|  |  |         if(doctor.getLevel()==10&&sendType==2){
 | 
	
		
			
				|  |  |         //1、普通医生,2、管理员
 | 
	
		
			
				|  |  |         if(sendType==2){
 | 
	
		
			
				|  |  |             String resultSql ="";
 | 
	
		
			
				|  |  |             String whereSql ="";
 | 
	
		
			
				|  |  |             String temp = "";
 | 
	
		
			
				|  |  |             for(String one :roleList){
 | 
	
		
			
				|  |  |                 temp+=",'"+one+"'";
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             if(!StringUtils.isEmpty(temp)){
 | 
	
		
			
				|  |  |                 temp=temp.substring(1);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             switch (level){
 | 
	
		
			
				|  |  |                 case 1:{resultSql +=" DISTINCT (province_name) as name";
 | 
	
		
			
				|  |  |                     whereSql+=" and province in ("+temp+")";break;}
 | 
	
		
			
				|  |  |                 case 2:{resultSql +=" DISTINCT (city_name) as name";
 | 
	
		
			
				|  |  |                     whereSql+=" and city in ("+temp+")";break;}
 | 
	
		
			
				|  |  |                 case 3:{resultSql +=" DISTINCT (town_name) as name";
 | 
	
		
			
				|  |  |                     whereSql+=" and town in ("+temp+")";break;}
 | 
	
		
			
				|  |  |                 case 4:{resultSql +=" DISTINCT (name) as name";
 | 
	
		
			
				|  |  |                     whereSql+=" and code in ("+temp+")";break;}
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             switch (currentUserRoleLevel){
 | 
	
		
			
				|  |  |                 case "1":{resultSql +=" DISTINCT (province_name) as name";
 | 
	
		
			
				|  |  |                     whereSql+=" and province ='"+currentUserRoleCode+"'";break;}
 | 
	
		
			
				|  |  |                 case "2":{resultSql +=" DISTINCT (city_name) as name";
 | 
	
		
			
				|  |  |                     whereSql+=" and city ='"+currentUserRoleCode+"'";break;}
 | 
	
		
			
				|  |  |                 case "3":{resultSql +=" DISTINCT (town_name) as name";
 | 
	
		
			
				|  |  |                     whereSql+=" and town ='"+currentUserRoleCode+"'";break;}
 | 
	
		
			
				|  |  |                 case "4":{resultSql +=" DISTINCT (name) as name";
 | 
	
		
			
				|  |  |                     whereSql+=" and code ='"+currentUserRoleCode+"'";break;}
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             String sql = "select "+resultSql+" from dm_hospital  where level=2 "+whereSql ;
 | 
	
		
			
				|  |  |             List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  |             temp = "";
 | 
	
		
			
				|  |  |             for(Map<String, Object> one :returnList){
 | 
	
		
			
				|  |  |                 temp +=","+one.get("name");
 | 
	
		
			
				|  |  |             sendName = returnList.get(0).get("name")+"";
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(sendCode);
 | 
	
		
			
				|  |  |             List<String> roleList = (List<String>)resultMap.get("roleList");
 | 
	
		
			
				|  |  |             List<RoleVo> roleVoLists= new ArrayList<>();
 | 
	
		
			
				|  |  |             for(String one:roleList){
 | 
	
		
			
				|  |  |                 RoleVo roleVo = new RoleVo();
 | 
	
		
			
				|  |  |                 roleVo.setCode(one);
 | 
	
		
			
				|  |  |                 roleVoLists.add(roleVo);
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |             sendName = StringUtils.isEmpty(temp)?"":temp.substring(1);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         List<RoleVo> roleVoLists= new ArrayList<>();
 | 
	
		
			
				|  |  |         for(String one:roleList){
 | 
	
		
			
				|  |  |             RoleVo roleVo = new RoleVo();
 | 
	
		
			
				|  |  |             roleVo.setCode(one);
 | 
	
		
			
				|  |  |             roleVoLists.add(roleVo);
 | 
	
		
			
				|  |  |             healthEduArticlePatient.setRoleList(roleVoLists);
 | 
	
		
			
				|  |  |             healthEduArticlePatient.setCurrentUserRoleCode(currentUserRoleCode);
 | 
	
		
			
				|  |  |             healthEduArticlePatient.setCurrentUserRoleLevel(currentUserRoleLevel);
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  |             healthEduArticlePatient.setCurrentUserRoleCode(doctor.getHospital());
 | 
	
		
			
				|  |  |             healthEduArticlePatient.setCurrentUserRoleLevel("4");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         healthEduArticlePatient.setRoleList(roleVoLists);
 | 
	
		
			
				|  |  |         healthEduArticlePatient.setSendType(sendType);
 | 
	
		
			
				|  |  |         healthEduArticlePatient.setDoctorCode(sendCode);
 | 
	
		
			
				|  |  |         healthEduArticlePatient.setSendName(sendName);
 | 
	
		
			
				|  |  |         healthEduArticlePatient.setSendType(2);
 | 
	
		
			
				|  |  |         healthEduArticlePatient.setAdminTeamCode(teamId);
 | 
	
		
			
				|  |  |         healthEduArticlePatient.setLeaveWords(leaveWords);
 | 
	
		
			
				|  |  |         if (doctor != null) {
 | 
	
	
		
			
				|  | @ -314,63 +423,10 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  |         elastricSearchSave.save(healthEduArticlePatient, esIndex, esType);
 | 
	
		
			
				|  |  |         return healthEduArticlePatient;
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //    public Map<String, Object> getUnitLabels(String userId) {
 | 
	
		
			
				|  |  | //        String sql2 = "select r.code as roleCode from wlyy_user_role u " +
 | 
	
		
			
				|  |  | //                "left join wlyy_role r on r.`code`=u.role where u.user='" + userId + "'";
 | 
	
		
			
				|  |  | //        List<Map<String, Object>> resultMap = jdbcTemplate.queryForList(sql2);
 | 
	
		
			
				|  |  | //        String whereSql = "";
 | 
	
		
			
				|  |  | //        String role = fetchUserHighestAuthority(resultMap);
 | 
	
		
			
				|  |  | //        String resultSql = "";
 | 
	
		
			
				|  |  | //        if(role.length()==6){
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //            if("00".equals(role.substring(4))){
 | 
	
		
			
				|  |  | //                resultSql +=" DISTINCT (city_name) as name";
 | 
	
		
			
				|  |  | //                whereSql+=" and city = '"+role+"'";
 | 
	
		
			
				|  |  | //            }else{
 | 
	
		
			
				|  |  | //                resultSql +=" DISTINCT (town_name) as name";
 | 
	
		
			
				|  |  | //                whereSql+=" and town = '"+role+"'";
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | //        }else{
 | 
	
		
			
				|  |  | //            resultSql +=" DISTINCT (name) as name ";
 | 
	
		
			
				|  |  | //            whereSql+=" and code = '"+role+"'";
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        String sql = "select "+resultSql+" from dm_hospital  where level=2 "+whereSql ;
 | 
	
		
			
				|  |  | //        List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        return returnList.get(0);
 | 
	
		
			
				|  |  | //    }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | //    /**
 | 
	
		
			
				|  |  | //     * 获取用户的最高角色权限
 | 
	
		
			
				|  |  | //     * @param resultMap
 | 
	
		
			
				|  |  | //     * @return
 | 
	
		
			
				|  |  | //     */
 | 
	
		
			
				|  |  | //    public String fetchUserHighestAuthority(List<Map<String, Object>> resultMap){
 | 
	
		
			
				|  |  | //        String result = "";
 | 
	
		
			
				|  |  | //        String role = "";
 | 
	
		
			
				|  |  | //        for(Map<String, Object> one:resultMap){
 | 
	
		
			
				|  |  | //            role = one.get("roleCode").toString();
 | 
	
		
			
				|  |  | //            if(role.length()==6){
 | 
	
		
			
				|  |  | //                if("00".equals(role.substring(4))){//市级
 | 
	
		
			
				|  |  | //                    return role;
 | 
	
		
			
				|  |  | //                }else {
 | 
	
		
			
				|  |  | //                    result = role;
 | 
	
		
			
				|  |  | //                }
 | 
	
		
			
				|  |  | //            }else{
 | 
	
		
			
				|  |  | //                if(StringUtils.isEmpty(result)||result.length()>6){
 | 
	
		
			
				|  |  | //                    result = role;
 | 
	
		
			
				|  |  | //                }
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        return result;
 | 
	
		
			
				|  |  | //    }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     public JSONObject pushArticleConfirm(String articleId, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode) throws Exception {
 | 
	
		
			
				|  |  |     public JSONObject pushArticleConfirm(String articleId, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode,String currentUserRole, String currentUserRoleLevel) throws Exception {
 | 
	
		
			
				|  |  |         JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
 | 
	
		
			
				|  |  |         Set<String> patientSet = new HashSet<>();
 | 
	
		
			
				|  |  |         initPatient(patientSet, labelUnit, labelSex, labelServe, labelDisease, labelHealth,userCode);
 | 
	
		
			
				|  |  |         initPatient(patientSet, labelUnit, labelSex, labelServe, labelDisease, labelHealth,userCode,currentUserRole,currentUserRoleLevel);
 | 
	
		
			
				|  |  |         long num = patientSet.size();
 | 
	
		
			
				|  |  |         JSONObject result = new JSONObject();
 | 
	
		
			
				|  |  |         result.put("num", num);
 | 
	
	
		
			
				|  | @ -388,7 +444,7 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  |      * @param labelHealth
 | 
	
		
			
				|  |  |      * @param userCode
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void initPatient(Set<String> patientSet, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode) {
 | 
	
		
			
				|  |  |     public void initPatient(Set<String> patientSet, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode,String currentUserRole, String currentUserRoleLevel) {
 | 
	
		
			
				|  |  |         //全选的时候前端传0,后台要去数据库再查询一次
 | 
	
		
			
				|  |  | //        if ("0".equals(labelUnit)) {
 | 
	
		
			
				|  |  | //            //查找全部的下属单位
 | 
	
	
		
			
				|  | @ -427,21 +483,37 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         //通过登录的角色区域权限 限制所属患者条件
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |         Map<String,Object> resultLevel = labelService.fetchUserHighestAuthority(userCode);
 | 
	
		
			
				|  |  |         List<String> list =  (List<String>)resultLevel.get("roleList");
 | 
	
		
			
				|  |  |         Integer level = (Integer)resultLevel.get("level");
 | 
	
		
			
				|  |  |         StringBuilder role = new StringBuilder();
 | 
	
		
			
				|  |  |         for(String one :list){
 | 
	
		
			
				|  |  |             role.append(",'"+one+"'");
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |         String roleSql = !StringUtils.isEmpty(role+"")?role.substring(1):"";
 | 
	
		
			
				|  |  |         if(StringUtils.isEmpty(roleSql)){
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             switch (level){
 | 
	
		
			
				|  |  |                 case 1:{whereSql+=" and h.province in ("+role+")" ;break;}
 | 
	
		
			
				|  |  |                 case 2:{whereSql+=" and h.city in ("+role+")" ;break;}
 | 
	
		
			
				|  |  |                 case 3:{whereSql+=" and h.town in ("+role+")" ;break;}
 | 
	
		
			
				|  |  |                 case 4:{whereSql+=" and h.code in ("+role+")" ;break;}
 | 
	
		
			
				|  |  | //        Map<String,Object> resultLevel = labelService.fetchUserHighestAuthority(userCode);
 | 
	
		
			
				|  |  | //        List<String> list =  (List<String>)resultLevel.get("roleList");
 | 
	
		
			
				|  |  | //        Integer level = (Integer)resultLevel.get("level");
 | 
	
		
			
				|  |  | //        StringBuilder role = new StringBuilder();
 | 
	
		
			
				|  |  | //        for(String one :list){
 | 
	
		
			
				|  |  | //            role.append(",'"+one+"'");
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        String roleSql = !StringUtils.isEmpty(role+"")?role.substring(1):"";
 | 
	
		
			
				|  |  | //        if(StringUtils.isEmpty(roleSql)){
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //            switch (level){
 | 
	
		
			
				|  |  | //                case 1:{whereSql+=" and h.province in ("+role+")" ;break;}
 | 
	
		
			
				|  |  | //                case 2:{whereSql+=" and h.city in ("+role+")" ;break;}
 | 
	
		
			
				|  |  | //                case 3:{whereSql+=" and h.town in ("+role+")" ;break;}
 | 
	
		
			
				|  |  | //                case 4:{whereSql+=" and h.code in ("+role+")" ;break;}
 | 
	
		
			
				|  |  | //            }
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  |         if(!StringUtils.isEmpty(labelUnit)){
 | 
	
		
			
				|  |  |             switch (currentUserRoleLevel){
 | 
	
		
			
				|  |  |                 case "1":{whereSql+=" and h.city in ("+labelUnit+")" ;break;}
 | 
	
		
			
				|  |  |                 case "2":{whereSql+=" and h.town in ("+labelUnit+")" ;break;}
 | 
	
		
			
				|  |  |                 case "3":{whereSql+=" and h.code in ("+labelUnit+")" ;break;}
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }else{
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |             switch (currentUserRoleLevel){
 | 
	
		
			
				|  |  |                 case "1":{whereSql+=" and h.province = '"+currentUserRole+"'" ;break;}
 | 
	
		
			
				|  |  |                 case "2":{whereSql+=" and h.city = '"+currentUserRole+"'" ;break;}
 | 
	
		
			
				|  |  |                 case "3":{whereSql+=" and h.town = '"+currentUserRole+"'" ;break;}
 | 
	
		
			
				|  |  |                 case "4":return;
 | 
	
		
			
				|  |  |             }
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  | 
 | 
	
	
		
			
				|  | @ -846,7 +918,7 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  |      * @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,Integer sEcho) throws Exception{
 | 
	
		
			
				|  |  |                                           String userCode, String currentUserRole, String currentUserRoleLevel, String isAuthentication, Boolean isMyArticle, Integer page, Integer pageSize,Integer sEcho,Integer roleType) throws Exception{
 | 
	
		
			
				|  |  | //        Doctor doctor = doctorDao.findByCode(userCode);
 | 
	
		
			
				|  |  | //        boolean isManage = false;
 | 
	
		
			
				|  |  | //        if(doctor.getLevel()==10){
 | 
	
	
		
			
				|  | @ -856,7 +928,7 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  | //            userCode = null;
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  |         return thirdJkEduArticleService.queryArticlePcList(firstLevelCategoryId,secondLevelCategoryId,insertTimeStart,insertTimeEnd,articlelevel,isMyArticle,
 | 
	
		
			
				|  |  |                 articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize,sEcho);
 | 
	
		
			
				|  |  |                 articleTitle,userCode,isAuthentication,currentUserRole,currentUserRoleLevel,page,pageSize,sEcho,roleType);
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  |     /**
 | 
	
	
		
			
				|  | @ -893,7 +965,10 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  |      */
 | 
	
		
			
				|  |  |     public void saveOrUpdateArticleQR(String currentRoleLevel,String currentRoleCode,Integer position,String imgUrl,String userCode,Integer id) throws Exception{
 | 
	
		
			
				|  |  | //        thirdJkEduArticleService.getArticleQRCode(currentRoleLevel,currentRoleCode);
 | 
	
		
			
				|  |  |         imgUrl = commonUtil.copyTempImage(imgUrl);
 | 
	
		
			
				|  |  | //        if(StringUtils.isEmpty()){
 | 
	
		
			
				|  |  | //
 | 
	
		
			
				|  |  | //        }
 | 
	
		
			
				|  |  | //        imgUrl = commonUtil.copyTempImage(imgUrl);
 | 
	
		
			
				|  |  |         Doctor doctor = doctorDao.findByCode(userCode);
 | 
	
		
			
				|  |  |         String userName = doctor.getName();
 | 
	
		
			
				|  |  |         String orgId = doctor.getHospital();
 | 
	
	
		
			
				|  | @ -913,4 +988,6 @@ public class JMJkEduArticleService extends BaseService {
 | 
	
		
			
				|  |  |             thirdJkEduArticleService.authenticationArticle(one,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName);
 | 
	
		
			
				|  |  |         }
 | 
	
		
			
				|  |  |     }
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | 
 | 
	
		
			
				|  |  | }
 |