Kaynağa Gözat

集美宣教代码提交

liuwenbin 7 yıl önce
ebeveyn
işleme
b2cbc6a50b

+ 64 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -76,7 +76,8 @@ public class JMJkEduArticleService extends BaseService {
     * @return
     * @throws Exception
     */
    public List<HealthEduArticlePatientModel> pushArticleList(int page, int pagesize, String sendCode,  String firstLevelCategoryId,Integer myArticle,Integer sendType,String currentUserRole, String currentUserRoleLevel) throws Exception {
    public List<HealthEduArticlePatientModel> pushArticleList(int page, int pagesize, String sendCode,  String firstLevelCategoryId,String secondLevelCategoryId,Integer myArticle,Integer sendType,String currentUserRole,
                                                              String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
        pagesize = page * pagesize;
        page = (page - 1) * pagesize;
//        if(loginType==2){
@ -96,12 +97,25 @@ public class JMJkEduArticleService extends BaseService {
        if(!StringUtils.isEmpty(firstLevelCategoryId)){
            sql2.append("and level1Type="+firstLevelCategoryId);
        }
        if(!StringUtils.isEmpty(secondLevelCategoryId)){
            sql2.append("and level2Type="+secondLevelCategoryId);
        }
        if(myArticle==1){
            sql2.append(" and operatorId="+sendCode);
        }
        sql2.append(" and currentUserRoleCode ="+currentUserRole);
        sql2.append(" and currentUserRoleLevel="+currentUserRoleLevel);
        if(!StringUtils.isEmpty(articleTitle)){
            sql2.append(" and attachedTitle like'%"+articleTitle+"%'");
        }
        if(!StringUtils.isEmpty(sendTimeStart)){
            sendTimeStart = elasticsearchUtil.changeTime(sendTimeStart);
            sql2.append(" and createTime >='"+sendTimeStart+"'");
        }
        if(!StringUtils.isEmpty(sendTimeEnd)){
            sendTimeEnd = elasticsearchUtil.changeTime(sendTimeEnd);
            sql2.append(" and createTime <='"+sendTimeEnd+"'");
        }
        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<>();
@ -155,6 +169,54 @@ public class JMJkEduArticleService extends BaseService {
        return resultList;
    }
    /**
     *
     * @param page
     * @param pagesize
     * @param sendCode
     * @param firstLevelCategoryId 一级分类
     * @param myArticle (条件:我的文章)
     * @param sendType  1、医生,2、卫计委(管理员)
     * @return
     * @throws Exception
     */
    public List<HealthEduArticlePatient> pushArticleListCount(String sendCode,  String firstLevelCategoryId,String secondLevelCategoryId,Integer myArticle,Integer sendType,String currentUserRole,
                                                              String currentUserRoleLevel,String articleTitle,String sendTimeStart,String sendTimeEnd) throws Exception {
        StringBuffer sql2 = new StringBuffer("select *  from   " + esType +
                " where  doctorCode='" + sendCode + "'");
        if(sendType==1){
            sql2.append(" and sendType='"+sendType+"' ");
        }
        if(!StringUtils.isEmpty(firstLevelCategoryId)){
            sql2.append("and level1Type="+firstLevelCategoryId);
        }
        if(!StringUtils.isEmpty(secondLevelCategoryId)){
            sql2.append("and level2Type="+secondLevelCategoryId);
        }
        if(myArticle==1){
            sql2.append(" and operatorId="+sendCode);
        }
        sql2.append(" and currentUserRoleCode ="+currentUserRole);
        sql2.append(" and currentUserRoleLevel="+currentUserRoleLevel);
        if(!StringUtils.isEmpty(articleTitle)){
            sql2.append(" and attachedTitle like'%"+articleTitle+"%'");
        }
        if(!StringUtils.isEmpty(sendTimeStart)){
            sendTimeStart = elasticsearchUtil.changeTime(sendTimeStart);
            sql2.append(" and createTime >='"+sendTimeStart+"'");
        }
        if(!StringUtils.isEmpty(sendTimeEnd)){
            sendTimeEnd = elasticsearchUtil.changeTime(sendTimeEnd);
            sql2.append(" and createTime <='"+sendTimeEnd+"'");
        }
        List<HealthEduArticlePatient> esList = elasticsearchUtil.excute(sql2.toString(), com.yihu.es.entity.HealthEduArticlePatient.class, esIndex, esType);
        return esList;
    }
    public static String computeTime(String create) {
        Date createDate = DateUtil.strToDate(create, "yyyy-MM-dd HH:mm:ss.SSS");
        Date nowDate = new Date();

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

@ -102,7 +102,7 @@ public class DoctorJMJkEduArticleController extends BaseController {
            if(StringUtils.isEmpty(currentRoleLevel)){
                currentRoleLevel = getCurrentRoleLevel();
            }
            List<HealthEduArticlePatientModel> eduArticlePatients = jmJkEduArticleService.pushArticleList(page,pagesize,getUID(),firstLevelCategoryId,myArticle,sendType,currentRoleCode,currentRoleLevel);
            List<HealthEduArticlePatientModel> eduArticlePatients = jmJkEduArticleService.pushArticleList(page, pagesize, getUID(),firstLevelCategoryId,secondLevelCategoryId,myArticle,sendType,currentRoleCode,currentRoleLevel,articleTitle,sendTimeStart,sendTimeEnd);
//            Long count = jmJkEduArticleService.pushArticleListCount(getUID(),2);
            return new ResultPageListModel(
                    page,
@ -114,6 +114,8 @@ public class DoctorJMJkEduArticleController extends BaseController {
        }
    }
    @RequestMapping(value = "manageSendArticleToPatients", method = RequestMethod.POST)
    @ApiOperation("卫计委(管理员)文章群推送")
    public BaseResultModel manageSendArticleToPatients(
@ -207,7 +209,6 @@ public class DoctorJMJkEduArticleController extends BaseController {
    @ResponseBody
    @RequestMapping(value = "doctorPushArticleConfirm",method = RequestMethod.GET)
    public String doctorPushArticleConfirm(
            @RequestParam(value = "code") String code,
            @RequestParam(value = "patient", required = false) String patient,
            @RequestParam(value = "group", required = false, defaultValue = "") String group,
            @RequestParam(value = "labelType", required = false) String labelType,
@ -215,13 +216,13 @@ public class DoctorJMJkEduArticleController extends BaseController {
            @RequestParam(value = "articleId", required = false) String articleId){
        try {
            if (StringUtils.isEmpty(code)) {
            if (StringUtils.isEmpty(articleId)) {
                return error(-1,"请至少选择一篇文章!");
            }
            if (StringUtils.isEmpty(patient) && StringUtils.isEmpty(group)) {
                return error(-1,"请至少选择一个患者!");
            }
            String[] articles = code.split(",");
            String[] articles = articleId.split(",");
            String[] patients = patient.split(",");
            String[] groups = group.split(",");
            if (articles.length == 0) {
@ -264,7 +265,7 @@ public class DoctorJMJkEduArticleController extends BaseController {
    @RequestMapping(value = "doctorSendArticleToPatients", method = RequestMethod.POST)
    @ApiOperation("医生文章群推送")
    public BaseResultModel doctorSendArticleToPatients(@RequestParam(value = "code") String code,
    public BaseResultModel doctorSendArticleToPatients(
                                              @RequestParam(value = "patient", required = false) String patient,
                                              @RequestParam(value = "group", required = false, defaultValue = "") String group,
                                              @RequestParam(value = "labelType", required = false) String labelType,
@ -275,13 +276,13 @@ public class DoctorJMJkEduArticleController extends BaseController {
                                              @RequestParam(value = "currentUserRoleLevel", required = false ,defaultValue = "4")String currentUserRoleLevel){
        try {
            if (StringUtils.isEmpty(code)) {
            if (StringUtils.isEmpty(articleId)) {
                return new BaseResultModel("请至少选择一篇文章!");
            }
            if (StringUtils.isEmpty(patient) && StringUtils.isEmpty(group)) {
                return new BaseResultModel("请至少选择一个患者!");
            }
            String[] articles = code.split(",");
            String[] articles = articleId.split(",");
            String[] patients = patient.split(",");
            String[] groups = group.split(",");
            if (articles.length == 0) {
@ -315,6 +316,7 @@ public class DoctorJMJkEduArticleController extends BaseController {
        }
    }
    @RequestMapping(value = "doctorSendArticleToSingle", method = RequestMethod.POST)
    @ApiOperation("医生文章单个患者推送")
    public BaseResultModel doctorSendArticleToSingle(

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

@ -1,9 +1,14 @@
package com.yihu.wlyy.web.doctor.jimeiJkEduPC;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.third.jkEduArticle.ThirdJkEduArticleService;
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;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -12,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Created by Trick on 2017/11/14.
 */
@ -207,4 +214,52 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
        }
    }
    /**医生、卫计委(管理员)-已推送文章
     * @param page
     * @param pagesize
     * @return
     */
    @RequestMapping(value = "pushArticleList", method = RequestMethod.GET)
    @ApiOperation("查询医生、卫计委(管理员)给患者推送健教文章列表 ")
    public String pushArticleList(
            @ApiParam(name = "firstLevelCategoryId", value = "文章一级分类", required = false) @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
            @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类", required = false) @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
            @ApiParam(name = "articleTitle", value = "文章标题", required = false) @RequestParam(value = "articleTitle", required = false) String articleTitle,
            @ApiParam(name = "sendTimeStart", value = "发送时间开始", required = false) @RequestParam(value = "sendTimeStart", required = false) String sendTimeStart,
            @ApiParam(name = "sendTimeEnd", value = "发送时间结束", required = false) @RequestParam(value = "sendTimeEnd", required = false) String sendTimeEnd,
            @ApiParam(name = "myArticle", value = "我的文章 1选中0未选", required = false) @RequestParam(value = "myArticle", required = false,defaultValue = "0") Integer myArticle,
            @ApiParam(name = "sendType", value = "1医生 2卫计委(管理员)", required = true) @RequestParam(value = "sendType", required = true) Integer sendType,
            @ApiParam(name = "iDisplayStart", value = "当前页 起始1", required = true) @RequestParam(value = "page", required = true) Integer page,
            @ApiParam(name = "iDisplayLength", value = "每页显示条数", required = true) @RequestParam(value = "pagesize", required = true) Integer pagesize,
            @ApiParam(name = "currentRoleCode", value = "当前登录的角色code", required = false) @RequestParam(value = "currentRoleCode", required = false) String currentRoleCode,
            @ApiParam(name = "currentRoleLevel", value = "当前登录的角色级别", required = false) @RequestParam(value = "currentRoleLevel", required = false) String currentRoleLevel,
            @ApiParam(name = "sEcho", value = "插件自带") @RequestParam(value = "sEcho", required = false) Integer sEcho) {
        try {
            if(StringUtils.isEmpty(currentRoleCode)){
                currentRoleCode = getCurrentRoleCode();
            }
            if(StringUtils.isEmpty(currentRoleLevel)){
                currentRoleLevel = getCurrentRoleLevel();
            }
            List<HealthEduArticlePatientModel> eduArticlePatients = jmJkEduArticleService.pushArticleList(page, pagesize, getUID(),firstLevelCategoryId,secondLevelCategoryId,myArticle,sendType,currentRoleCode,currentRoleLevel,articleTitle,sendTimeStart,sendTimeEnd);
//            Long count = jmJkEduArticleService.pushArticleListCount(getUID(),2);
            List<HealthEduArticlePatient> eduArticlePatientsCount = jmJkEduArticleService.pushArticleListCount(getUID(),firstLevelCategoryId,secondLevelCategoryId,myArticle,sendType,currentRoleCode,
                    currentRoleLevel, articleTitle,sendTimeStart, sendTimeEnd);
            net.sf.json.JSONObject obj = new net.sf.json.JSONObject();
            obj.put("Code", 100);
            obj.put("Message", "成功");
            JSONArray obj2 = new JSONArray();
            obj2.add(eduArticlePatients);
            obj.put("aaData",  obj2.toString());
            obj.put("iTotalDisplayRecords", eduArticlePatientsCount.size());
            obj.put("iTotalRecords", eduArticlePatientsCount.size());
            obj.put("sEcho", sEcho);
            return obj.toString();
        }catch (Exception e) {
            e.printStackTrace();
            return error(-1,"失败!");
        }
    }
}