Bläddra i källkod

健康文章的bug

liuwenbin 7 år sedan
förälder
incheckning
c4da3c1fe1

BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ArticleApi.class


+ 7 - 6
edu-article/JkEdu/src/com/yihu/jk/api/ArticleApi.java

@ -162,6 +162,7 @@ public class ArticleApi {
					jsonObj.put("browseNumber", StringUtil.getJSONValue(vbo.getBrowseNumber()));
					jsonObj.put("pointNumber", StringUtil.getJSONValue(vbo.getPointNumber()));
					jsonObj.put("commentNumber", StringUtil.getJSONValue(vbo.getCommentNumber()));
					jsonObj.put("pushNumber", StringUtil.getJSONValue(vbo.getPushNumber()));
					jsonObj.put("shareNumber", StringUtil.getJSONValue(vbo.getShareNumber()));
					jsonObj.put("collectionNumber", StringUtil.getJSONValue(vbo.getCollectionNumber()));
					jsonObj.put("articleContent",StringUtil.getJSONValue(vbo.getArticleContent()));
@ -249,12 +250,12 @@ public class ArticleApi {
						jsonObj.put("collectionNumberCount", collectionNumberCount);
						//判断该用户是否有收藏过该文章
						ArticleCollection vo1 = new ArticleCollection();
						vo1.setArticleId(articleId);
						vo1.setUserType(userType);
						vo1.setUserId(userId);
						int size = subDao.getArticleCollection(vo1);
						if(size>0){
//						ArticleCollection vo1 = new ArticleCollection();
//						vo1.setArticleId(articleId);
//						vo1.setUserType(userType);
//						vo1.setUserId(userId);
//						int size = subDao.getArticleCollection(vo1);
						if(collectionNumberCount>0){
							jsonObj.put("isCollection", 1);
						}else{
							jsonObj.put("isCollection", 0);

+ 12 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/SignWebService.java

@ -1052,13 +1052,15 @@ public class SignWebService extends BaseService {
        String reservation_sql = "select w.code,w.id, w.doctor_name,w.doctor_code,w.doctor_job,w.doctor,w.dname,w.org_code,w.status,w.start_time as czrq,3 as type from wlyy_patient_reservation  w where (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
        //获取健康教育
//        String article_sql = "select w.id,w.article,w2.title,w2.summary,w.czrq,w.doctor,w.doctor_name,w.is_read,4 as type from wlyy_health_edu_article_patient  w,wlyy_health_edu_article w2 where w.article = w2.code and  (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
        Date startTime = DateUtil.getBeginDayOfYear();
        Date endTime = DateUtil.getEndDayOfYear();
        String startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime);
        String endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endTime);
        String start = elasticsearchUtil.changeTime(startDate);
        String end = elasticsearchUtil.changeTime(endDate);
        String article_sql = "SELECT id,articleId as article,articleTitle as title,createTime as czrq,doctorCode as doctor,doctorName as doctor_name,isRead as is_read,articleContent as content FROM "+esIndex+" where userType='1' and patientCode='"+patient+"' and (doctorCode='"+doctorHealth+"' or doctorCode='"+doctor+"') and createTime>='"+start+"' and createTime<='"+end+"'";
//        Date startTime = DateUtil.getBeginDayOfYear();
//        Date endTime = DateUtil.getEndDayOfYear();
        String yearBegin = DateUtil.dateToStrShort(signFamily.getBegin()) + " 00:00:00";
        String yearEnd = DateUtil.dateToStrShort(signFamily.getEnd()) + " 23:59:59";
//        String startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(startTime);
//        String endDate = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(endTime);
        String start = elasticsearchUtil.changeTime(yearBegin);
        String end = elasticsearchUtil.changeTime(yearEnd);
        String article_sql = "SELECT id,articleId as article,articleTitle as title,createTime as czrq,doctorCode as doctor,doctorName as doctor_name,isRead as is_read,articleContent as content FROM "+esIndex+" where userType='1' and patientCode='"+patient+"' and (doctorCode='"+doctorHealth+"' or doctorCode='"+doctor+"') and createTime>='"+start+"' and createTime<'"+end+"'";
        //获取健康指导
        String guidance_sql = "select w.id,w.doctor,w.content,w.czrq,w.read_status,5 as type  from wlyy_patient_health_guidance  w where (w.doctor = ? or w.doctor =?) and w.patient =? and YEAR(w.czrq) = ? ";
@ -1076,10 +1078,12 @@ public class SignWebService extends BaseService {
//        List<HealthEduArticleES> esList = elasticsearchUtil.excute(article_sql, HealthEduArticleES.class, esIndex, esType);
        List<Map<String, Object>> articleResult = elasticsearchUtil.excuteDataModel(article_sql);
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String str = null;
        for(Map<String, Object> map :articleResult){
            map.put("type","4");
            map.put("czrq",map.get("czrq")!=null?simpleDateFormat.format(new Date(((Long)map.get("czrq")).longValue())):"");
            map.put("summary",map.get("content")!=null?(map.get("content").toString().length()>40?map.get("content").toString().substring(0,40):map.get("content").toString()):"");
            str = map.get("content")!=null?map.get("content").toString().replaceAll("</?[^>]+>", ""):null;
            map.put("summary",str!=null?(str.length()>40?str.substring(0,40):str):"");
        }
        //健康指导量
        List<Map<String, Object>> guidanceResult = jdbcTemplate.queryForList(guidance_sql, new Object[]{doctorHealth, doctor, patient, year});

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/ServiceStatisticsService.java

@ -99,7 +99,7 @@ public class ServiceStatisticsService extends BaseService {
        JSONObject guidance = getGuidanceStatistics(patient, teamCode, yearBegin, yearEnd, monthBegin);
        result.put("guidance", guidance);
        JSONObject article = getArticleStatistics(patient, teamCode, yearBegin, yearEnd, monthBegin);
        JSONObject article = getArticleStatistics(patient, teamCode, DateUtil.dateToStrShort(signFamily.getBegin()), DateUtil.dateToStrShort(signFamily.getEnd()), DateUtil.dateToStrShort(today.getTime()));
        result.put("article", article);
        return result;
@ -176,8 +176,8 @@ public class ServiceStatisticsService extends BaseService {
        //数据转移至Es
        String sqlHistory="select count(*) AS h from " + esType + " where patientCode='" + patient + "' and adminTeamCode = '"+teamCode+"'";
        String sqlYear = "select count(*) AS y from "+esType+" where patientCode='" + patient + "' and adminTeamCode = '"+teamCode+"' and czrq >= "+changeDate(yearBegin)+" and czrq <= "+changeDate(yearEnd);
        String sqlMonth = "select count(*) AS m from "+esType+" where patientCode='" + patient + "' and adminTeamCode = '"+teamCode+"' and czrq >= "+changeDate(monthBegin);
        String sqlYear = "select count(*) AS y from "+esType+" where patientCode='" + patient + "' and adminTeamCode = '"+teamCode+"' and createTime >= '"+changeDate(yearBegin)+"' and createTime <= '"+changeDate(yearEnd)+"'";
        String sqlMonth = "select count(*) AS m from "+esType+" where patientCode='" + patient + "' and adminTeamCode = '"+teamCode+"' and createTime >= '"+changeDate(monthBegin)+"'";
        result.put("history", elasticsearchUtil.excuteForLong(sqlHistory,esType,esIndex));
        result.put("year", elasticsearchUtil.excuteForLong(sqlYear,esType,esIndex));

+ 20 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -5122,4 +5122,24 @@ public class StatisticsESService {
        return new JSONArray(resultList);
    }
    /**
     * 查询截止某个日期累计量
     *
     * @param endDate     截止日期
     * @param area        区域或机构代码
     * @param level       级别
     * @param level2_type level2_type的类型
     * @return
     */
    public long getArticleTotal(String endDate, String area, int level, String index, String level2_type) throws Exception {
        SaveModel saveModel = null;
        if (StringUtils.isNotEmpty(level2_type)) {
            saveModel = elasticsearchUtil.findOneDateQuotaLevel1(endDate, area, level, index, SaveModel.timeLevel_DDL, level2_type);
        } else {
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, area, level, index, SaveModel.timeLevel_DDL);
        }
        return saveModel.getResult2().longValue();
    }
}

+ 13 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -114,7 +114,7 @@ public class JMJkEduArticleService extends BaseService {
//        }
        StringBuffer sql2 = new StringBuffer("select * from   " + esType +
                " where  doctorCode='" + sendCode + "' and userType = 2");
                " where  doctorCode='" + sendCode + "' and userType = 2 and currentUserRoleCode='"+currentUserRole+"' and sendType="+sendType);
//        if(sendType==1){
//
//            sql2.append(" and sendType='"+sendType+"' ");
@ -155,7 +155,7 @@ public class JMJkEduArticleService extends BaseService {
        for (HealthEduArticleES one : esList) {
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"","");
//            if (result.get(one.getArticleId()) != null) {
//                heapm = result.get(one.getArticleId());
//
@ -254,7 +254,7 @@ public class JMJkEduArticleService extends BaseService {
                                                              String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
        StringBuffer sql2 = new StringBuffer("select * from   " + esType +
                " where  doctorCode='" + sendCode + "' and userType = 2" );
                " where  doctorCode='" + sendCode + "' and userType = 2 and currentUserRoleCode='"+currentUserRole+"' and sendType="+sendType );
//        if(sendType==1){
//
//            sql2.append(" and sendType='"+sendType+"' ");
@ -383,7 +383,7 @@ public class JMJkEduArticleService extends BaseService {
            roleVo.setCode(ones.getCode());
            roleVoLists.add(roleVo);
        }
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"","");
        Date createTime = new Date();
        for (String patient : patientSet) {
@ -416,6 +416,10 @@ public class JMJkEduArticleService extends BaseService {
            }else{
                List<Object> results = teamDao.findAdminTeamByPatientSignTeam(patient, new PageRequest(0, 1));
                //没有签约的团队的患者不推送
                if(results.size()<=0){
                    continue;
                }
                Object[] result = (Object[]) results.get(0);
                healthEduArticleES.setAdminTeamName(result[1].toString());
                healthEduArticleES.setAdminTeamCode(Long.parseLong(result[0].toString()));
@ -464,7 +468,7 @@ public class JMJkEduArticleService extends BaseService {
        return healthEduArticleESList;
    }
    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,"");
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"","");
        Set<String> patientSet = new HashSet<>();
        initPatient(patientSet, labelUnit, labelSex, labelServe, labelDisease, labelHealth,userCode,currentUserRole,currentUserRoleLevel);
        long num = patientSet.size();
@ -697,7 +701,7 @@ public class JMJkEduArticleService extends BaseService {
    }
    public JSONObject pushArticleConfirm(String userCode,String[] groups,String group,String labelType,long teamCode,String[] patients,String articleId) throws Exception{
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"","");
        Set<String> patientSet = new HashSet<>();
        initPatients(userCode,groups,group,labelType,teamCode,patients,patientSet);
        long num = patientSet.size();
@ -862,7 +866,7 @@ public class JMJkEduArticleService extends BaseService {
        List<HealthEduArticlePatientModel> result = new ArrayList<>();
        Doctor doctor = null;
        for (HealthEduArticleES one : esList) {
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"","");
            heapm = new HealthEduArticlePatientModel();
            heapm.setSendName(one.getSendName());
            heapm.setSendCode(one.getDoctorCode());
@ -915,7 +919,7 @@ public class JMJkEduArticleService extends BaseService {
                            String opertorRoleLevel,Integer userScope,String articleId,Integer roleType) throws Exception {
        if(!StringUtils.isEmpty(articleId)){
            JSONObject obj = thirdJkEduArticleService.getArticalById(articleId,null);
            JSONObject obj = thirdJkEduArticleService.getArticalById(articleId,null,"");
            if(!StringUtils.isEmpty(image)&&!(obj.get("articleCover")+"").equals(image)){
                image = commonUtil.copyTempImage(image);
            };
@ -1124,7 +1128,7 @@ public class JMJkEduArticleService extends BaseService {
        List<HealthEduArticlePatientModel> result = new ArrayList<>();
        Doctor doctor = null;
        for (HealthEduArticleES one : esList) {
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"");
            article = thirdJkEduArticleService.getArticalById(one.getArticleId(),"","");
            heapm = new HealthEduArticlePatientModel();
            heapm.setSendName(one.getSendName());
            heapm.setSendCode(one.getDoctorCode());

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

@ -368,13 +368,14 @@ public class ThirdJkEduArticleService extends BaseService {
     * @param articleId 文章id
     * @return
     */
    public JSONObject getArticalById(String articleId,String userId) throws Exception {
    public JSONObject getArticalById(String articleId,String userId,String userType) throws Exception {
        JSONObject re = new JSONObject();
        JSONObject json = null;
        try {
            JSONObject param = new JSONObject();
            param.put("articleId", articleId);
            param.put("userId", userId);
            param.put("userType", userType);
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(getArticalById, param.toString(), "1"));
            json = JSON.parseObject(response);
        } catch (Exception e) {

+ 36 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -2128,4 +2128,40 @@ public class EsStatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    /**
     * 健康文章算到达量
     *
     * @param endDate     结束时间 1
     * @param area        父code
     * @param level       等级  1 团队,2 机构,3 区,4 市
     * @param index       指标代码 3 4 5 27
     * @param level2_type 指标代码 例如性别 1 男 2 女  不传就返回男和女的总和
     * @return
     */
    @RequestMapping("/article_total")
    @ResponseBody
    public String getArticleTotal(
//            @RequestParam(required = true) String startDate,
            @RequestParam(required = true) String endDate,
            @RequestParam(required = true) String area,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String index,
            @RequestParam(required = false) String level2_type) {
        try {
            //新版与旧版统计适配
            level = elasticsearchUtil.changeLevel(level);
            String[] indexes = index.split(",");
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
                result.put("index_" + idx, statisticsESService.getArticleTotal(endDate, area, level, idx, level2_type));
            }
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/service/GcEduArticleService.java

@ -250,7 +250,7 @@ public class GcEduArticleService {
        //通过文章id 获取文章详情
        JSONObject article = healthEducationArticleService.getArticalById(articleId,"");
        JSONObject article = healthEducationArticleService.getArticalById(articleId,"","");
        healthEduArticlePatient.setArticleId(article.get("articleId") + "");
        healthEduArticlePatient.setAttachedTitle(article.get("articleTitle") + "");

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

@ -121,7 +121,13 @@ public class ThirdJkEduArticleController extends BaseController {
                                 @ApiParam(name = "userType", value = "用户类型:1医生,2居民",defaultValue = "1")
                                 @RequestParam(value = "userType", required = false) String userType){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,getUID());
            String uid = "";
            if("2".equals(userType)){
                uid = getRepUID();
            }else{
                uid = getUID();
            }
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,uid,userType);
            if("2".equals(userType)){
                jmJkEduArticleService.readPatientArticle(getRepUID(),articleId);
@ -143,7 +149,13 @@ public class ThirdJkEduArticleController extends BaseController {
                                          @RequestParam(value = "userType", required = true) Integer userType
                                          ){
        try {
            thirdJkEduArticleService.cancelArticleCollection(articleId,getRepUID(),userType);
            String uid = "";
            if("2".equals(userType)){
                uid = getRepUID();
            }else{
                uid = getUID();
            }
            thirdJkEduArticleService.cancelArticleCollection(articleId,uid,userType);
//            thirdJkEduArticleService.cancelArticleCollection(articleId,"0de7295862dd11e69faffa163e8aee56",1);
            return success("取消成功!");
        }catch (Exception e){
@ -164,7 +176,13 @@ public class ThirdJkEduArticleController extends BaseController {
                                        @ApiParam(name = "userType", value = "用户类型:1医生,2居民",defaultValue = "1")
                                            @RequestParam(value = "userType", required = true) Integer userType){
        try {
            thirdJkEduArticleService.saveArticleCollection(articleId,articleCategoryId,articleCategoryName,getRepUID(),userType);
            String uid = "";
            if("2".equals(userType)){
                uid = getRepUID();
            }else{
                uid = getUID();
            }
            thirdJkEduArticleService.saveArticleCollection(articleId,articleCategoryId,articleCategoryName,uid,userType);
//            thirdJkEduArticleService.saveArticleCollection(articleId,articleCategoryId,articleCategoryName,"0de7295862dd11e69faffa163e8aee56",1);
            return success("收藏成功!");