소스 검색

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

huangwenjie 7 년 전
부모
커밋
e5ce9c12c4

+ 48 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -1033,5 +1033,53 @@ public class JMJkEduArticleService extends BaseService {
        }
    }
    /**
     * 查询给患者发送的健康教育文章
     *
     * @param patient
     * @param teamCode
     * @param page
     * @param pageSize
     * @return
     */
//    public List<Map<String, Object>> findByPatientAndTeam(String patient, long teamCode, int page, int pageSize) {
//        List<Object> params = new ArrayList<Object>();
//        String sql = "select " +
//                "    a.article" +
//                "    ,b.title" +
//                "    ,b.url" +
//                "    ,a.czrq" +
//                "    ,b.summary content" +
//                "    ,d.code" +
//                "    ,d.name" +
//                "    ,d.photo" +
//                "    ,a.admin_team_code" +
//                "    ,a.is_read" +
//                "    ,a.attached_content" +
//                "  from" +
//                "    wlyy_health_edu_article_patient a" +
//                "    ,wlyy_health_edu_article b" +
//                "    ,wlyy_doctor d" +
//                "  where" +
//                "    a.article = b.code " +
//                "    and a.doctor = d.code " +
//                "   and ( a.send_type =1 or a.send_type is null or a.send_type = '') "+  //添加类型判断是集美的推送还是三师原来的推送
//                "    and a.patient = ?" +
//                "    and a.admin_team_code = ?" +
//                "  order by a.czrq desc limit " + page*pageSize + "," + pageSize;
//
//        List<Map<String,Object>> result = jdbcTemplate.queryForList(sql,new Object[]{patient,teamCode});
//        return result;
//    }
    public List<HealthEduArticleES> findByPatientAndTeam(String patient, long teamCode, int page, int pageSize) {
        StringBuffer sql2 = new StringBuffer("select * from   " + esType +
                " where adminTeamCode='"+teamCode+"' and userType='1' and patientCode='"+patient+"' " );
        sql2.append(" order by createTime desc limit " + page + "," + pageSize);
        List<HealthEduArticleES> esList = elasticsearchUtil.excute(sql2.toString(),HealthEduArticleES.class, esIndex, esType);
        return esList;
    }
}

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

@ -109,6 +109,7 @@ public class ThirdJkEduArticleService extends BaseService {
    private String saveArticleQRCode = "JkEdu.ArticleQR.saveArticleQRCode";//添加认证标识
    private String getArticleQRCodeById = "JkEdu.ArticleQR.getArticleQRCodeById";//根据id获取认证标识
    private String saveBehavior = "JkEdu.Behavior.saveBehavior";//根据id获取认证标识
    private String insertArticleStatistic = "JkEdu.Article.insertArticleStatistic";//旧数据文章刷新articleStatistic
    /**
     * 封装入参
     *
@ -997,4 +998,20 @@ public class ThirdJkEduArticleService extends BaseService {
        }
        return false;
    }
    public void insertArticleStatistic() throws Exception{
        JSONObject json = null;
        try{
            JSONObject param = new JSONObject();
            String response = httpClientUtil.httpPost(articleBaseUrl+"/WsPlatform/rest", getParamsMap(insertArticleStatistic, param.toString(), "1"));
            json = JSON.parseObject(response);
        }catch (Exception e) {
            e.printStackTrace();
        }
        if (!"10000".equals(json.getString("Code"))) {
            throw new Exception(json.getString("Message"));
        }
    }
}

+ 62 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEdu/DoctorJMJkEduArticleController.java

@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
@ -12,6 +13,7 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
@ -23,9 +25,7 @@ import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.*;
/**
 * Created by Trick on 2017/11/14.
@ -453,4 +453,63 @@ public class DoctorJMJkEduArticleController extends BaseController {
            return error(-1,"查询失败!");
        }
    }
    /**
     * 查询发送给居民的文章列表
     *
     * @param pagesize 分页大小
     * @return 列表
     */
    @RequestMapping(value = "list_by_team", method = {RequestMethod.GET, RequestMethod.POST})
    @ResponseBody
    @ApiOperation(value = "查询发送给居民的文章列表")
    public String listByTeam(@RequestParam @ApiParam(value = "第几页") int page,
                             @RequestParam @ApiParam(value = "页大小") int pagesize,
                             @RequestParam @ApiParam(value = "居民code") String patient,
                             @RequestParam @ApiParam(value = "团队code") Long teamCode) {
        try {
            if (StringUtils.isEmpty(patient)) {
                return error(-1, "请输入需查询的居民");
            }
            if (teamCode == null || teamCode < 1) {
                return error(-1, "请输入需查询的居民的团队");
            }
            page = page > 0 ? page - 1 : 0;
            List<HealthEduArticleES> list = jmJkEduArticleService.findByPatientAndTeam(patient, teamCode, page, pagesize);
            JSONArray jsonArray = new JSONArray();
            if (list != null) {
                for (HealthEduArticleES map : list) {
                    org.json.JSONObject json = new org.json.JSONObject();
                    // 文章标识
                    json.put("doctorCode", map.getDoctorCode());
                    // 文章标识
                    json.put("doctorName", map.getDoctorName());
                    // 文章标识
                    json.put("doctorPhoto", map.getSendPic());
                    // 文章标识
                    json.put("code", map.getArticleId());
                    // 文章标题
                    json.put("title", map.getArticleTitle());
                    // 文章查看URL
//                    json.put("url", map.get("url"));
                    // 文章简介
                    //json.put("content", parsrHtml(map.get("content").toString()));
                    json.put("content", map.getArticleContent());
                    json.put("read", map.getIsRead());
                    json.put("attached_content", map.getLeaveWords());
                    // 发送日期
                    json.put("czrq", DateUtil.dateToStrLong(map.getCzrq()));
                    // 发送团队
                    json.put("adminTeamCode", map.getAdminTeamCode());
                    jsonArray.put(json);
                }
            }
            return write(200, "查询成功", "data", jsonArray);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, "查询失败!");
        }
    }
}

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

@ -373,4 +373,18 @@ public class ThirdJkEduArticleController extends BaseController {
            return error(-1,"查询失败!");
        }
    }
    @RequestMapping(value = "insertArticleStatistic",method = RequestMethod.POST)
    @ApiOperation("旧数据文章迁移,user_articlestatistics文章统计表也更新一份")
    public String insertArticleStatistic(){
        try {
            thirdJkEduArticleService.insertArticleStatistic();
            return write(200,"更新成功!");
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"更新失败!");
        }
    }
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -105,11 +105,11 @@ pushMes:
  redis_prescription_title: redisMessage
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_test6
    HealthEduArticlePatient: health_edu_article_patient_test3
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
  type:
    HealthEduArticlePatient: health_edu_article_patient_test6
    HealthEduArticlePatient: health_edu_article_patient_test3
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
  host:  http://172.19.103.68:9200