Przeglądaj źródła

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

liuwenbin 6 lat temu
rodzic
commit
4cdbd1f131

+ 13 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java

@ -635,5 +635,18 @@ public class CustomerSynergyManageController extends BaseController {
            return write(-1,"获取失败!");
        }
    }
    @RequestMapping(value = "deleteWorkorder",method = RequestMethod.POST)
    @ApiOperation(value = "删除工单")
    public String deleteWorkorder(@ApiParam(name="workorderCode",value="工单code",required = true)
                                 @RequestParam(required = true)String workorderCode){
        try{
            synergyManageService.deleteWorkorder(workorderCode);
            return write(200,"删除成功!");
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"删除失败!");
        }
    }
}

+ 3 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/doctor/DoctorSynergyManageController.java

@ -53,6 +53,8 @@ public class DoctorSynergyManageController extends BaseController {
                                @RequestParam(value = "isAcceptTask", required = true)Integer isAcceptTask,
                                @ApiParam(name = "keywords", value = "输入医生姓名、姓名、社保卡、身份证号码", required = false)
                                @RequestParam(value = "keywords", required = false)String keywords,
                                @ApiParam(name = "userType", value = "1、医生,4、医生管理员", required = true)
                                @RequestParam(value = "userType", required = true)Integer userType,
                                @ApiParam(name = "page", value = "第几页,从1开始", required = false)
                                @RequestParam(value = "page", required = false,defaultValue = "1")Integer page,
                                @ApiParam(name = "pageSize", value = "每页分页大小", required = false)
@ -62,7 +64,7 @@ public class DoctorSynergyManageController extends BaseController {
                userCode = getUID();
            }
            Map<String,Object> result = synergyManageService.workorderList(userCode,keywords,workorderType,null,status,null,null,null,
                    null,serviceStartTime,serviceEndTime,null,null,null,1,isAcceptTask,null,null,page,pageSize);
                    null,serviceStartTime,serviceEndTime,null,null,null,userType,isAcceptTask,null,null,page,pageSize);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);

+ 6 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkOrderDao.java

@ -1,9 +1,15 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface ManageSynergyWorkOrderDao extends PagingAndSortingRepository<ManageSynergyWorkorderDO, Long> {
    ManageSynergyWorkorderDO findByCode(String workorderCode);
    @Modifying
    @Query("update ManageSynergyWorkorderDO a set a.del=1 where a.code = ?1")
    int deleteByCode(String workorderCode);
}

+ 19 - 3
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java

@ -106,7 +106,7 @@ public class SynergyManageService extends BaseJpaService {
     * @param patientName
     * @param ssc 社保卡号
     * @param idcard 身份证
     * @param userType 1、医生,2、客服,3、客服管理员
     * @param userType 1、医生,2、客服,3、客服管理员,4、医生管理员
     * @param isAcceptTask 1、我接收到的任务,2、我派发的任务,3、待接收(客服管理员),4、已接收(客服管理员)
     * @return
     * @throws Exception
@ -137,11 +137,17 @@ public class SynergyManageService extends BaseJpaService {
        }else if(userType==1){//医生
            if(isAcceptTask==1){//我接收
                whereSql +=" and w.create_user_type=2 ";//创建人为客服
                whereSql += " and e.executor_code ='"+code+"' ";
            }else if(isAcceptTask==2){//我派发
                whereSql +=" and w.create_user_type=1 ";//创建人为医生
                whereSql += " and w.create_user_type=1 ";//创建人为医生
                whereSql += " and w.create_user ='"+code+"' ";
                whereSql += " and w.create_user_role=1 ";
            }
        }else if(userType==4){//医生管理员
            if(isAcceptTask==2){
                whereSql += " and w.create_user_type=1 ";//创建人为医生
                whereSql += " and w.create_user ='"+code+"' ";
                whereSql += " and w.create_user_role=2 ";
            }
        }
@ -292,6 +298,8 @@ public class SynergyManageService extends BaseJpaService {
        resultMap.put("pageSize",pageSize);
        resultMap.put("totalCount",count);
        resultMap.put("detailModelList",resultList);
        double t = (double)count;
        resultMap.put("total",Math.ceil(t/pageSize));
        return resultMap;
    }
@ -1934,4 +1942,12 @@ public class SynergyManageService extends BaseJpaService {
        throw new Exception();
    }
    @Transactional
    public void deleteWorkorder(String workorderCode) throws Exception{
        int a  = workOrderDao.deleteByCode(workorderCode);
        if(a<0){
            throw new Exception("删除失败");
        }
    }
}

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/ManageSynergyService.java

@ -144,7 +144,7 @@ public class ManageSynergyService extends BaseService {
    public JSONObject workorderList(String userCode,Integer workorderType,Integer status,String serviceStartTime,String serviceEndTime,Integer isAcceptTask,String keywords,Integer page,Integer pageSize) throws Exception{
    public JSONObject workorderList(String userCode,Integer workorderType,Integer status,String serviceStartTime,String serviceEndTime,Integer isAcceptTask,String keywords,Integer userType,Integer page,Integer pageSize) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("userCode",userCode);
        param.put("workorderType",workorderType);
@ -153,6 +153,7 @@ public class ManageSynergyService extends BaseService {
        param.put("serviceEndTime",serviceEndTime);
        param.put("isAcceptTask",isAcceptTask);
        param.put("keywords",keywords);
        param.put("userType",userType);
        param.put("page",page);
        param.put("pageSize",pageSize);
        HttpResponse response = HttpUtils.doGet(customerUrl + "/synergy/doctor/workorderList", param);

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

@ -25,11 +25,13 @@ import org.springframework.jms.core.JmsTemplate;
import org.springframework.jms.core.MessageCreator;
import org.springframework.web.bind.annotation.*;
import javax.annotation.PostConstruct;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;
import javax.jms.TextMessage;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
/**
 * Created by Trick on 2017/11/14.
@ -52,7 +54,8 @@ public class DoctorJMJkEduArticleController extends BaseController {
    private String articleBaseUrl;
    @Autowired
    DoctorAdminTeamDao teamDao;
    // 最大容量为50的数组堵塞队列
    private static LinkedBlockingQueue<JSONObject> queue = new LinkedBlockingQueue<>();
    /**
     * 发送到redis
@ -153,10 +156,20 @@ public class DoctorJMJkEduArticleController extends BaseController {
//            patientSet.add("915cc456-5b1d-11e6-8344-fa163e8aee56");
            List<HealthEduArticleES> healthEduArticleESList = jmJkEduArticleService.savePCPushArticle(patientSet, getUID(), 2,"", 0L, articleId,leaveWords,currentRoleCode,currentRoleLevel);
            //推送微信模板消息和发送im消息
            new Thread(() -> {
                //发送任务到redis
                sender(healthEduArticleESList);
            }).start();
//            new Thread(() -> {
//                //发送任务到redis
//                sender(healthEduArticleESList);
//            }).start();
            JSONObject json = new JSONObject();
            json.put("patientSet",patientSet);
            json.put("sendType",2);
            json.put("teamCode",0L);
            json.put("articleId",articleId);
            json.put("leaveWords",leaveWords);
            json.put("currentUserRole",currentRoleCode);
            json.put("currentUserRoleLevel",currentRoleLevel);
            json.put("sendCode",getUID());
            queue.put(json);
            return new BaseResultModel();
        }catch (Exception e) {
            e.printStackTrace();
@ -362,43 +375,82 @@ public class DoctorJMJkEduArticleController extends BaseController {
//                //发送任务到redis
//                sender(healthEduArticleESList);
//            }).start();
            new Thread(new HealthEduArticleESTask(patientSet,sendType,teamCode,articleId,leaveWords,currentUserRole,currentUserRoleLevel,getUID())).start();
//            new Thread(new HealthEduArticleESTask(patientSet,sendType,teamCode,articleId,leaveWords,currentUserRole,currentUserRoleLevel,getUID())).start();
            JSONObject json = new JSONObject();
            json.put("patientSet",patientSet);
            json.put("sendType",sendType);
            json.put("teamCode",teamCode);
            json.put("articleId",articleId);
            json.put("leaveWords",leaveWords);
            json.put("currentUserRole",currentUserRole);
            json.put("currentUserRoleLevel",currentUserRoleLevel);
            json.put("sendCode",getUID());
            queue.put(json);
            return new BaseResultModel();
        } catch (Exception e) {
            error(e);
            return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
        }
    }
    @PostConstruct
    private void run() {
        new Thread(new HealthEduArticleESTask()).start();
    }
    // 消费者
    class HealthEduArticleESTask implements Runnable {
        Set<String> patientSet;
        String sendType;
        Long teamCode;
        String articleId;
        String leaveWords;
        String currentUserRole;
        String currentUserRoleLevel;
        String sendCode;
        public HealthEduArticleESTask(Set<String> patientSet,String sendType,Long teamCode,String articleId,String leaveWords,String currentUserRole,String currentUserRoleLevel,String sendCode)  {
            this.patientSet=patientSet;
            this.sendType=sendType;
            this.teamCode=teamCode;
            this.articleId=articleId;
            this.leaveWords=leaveWords;
            this.currentUserRole=currentUserRole;
            this.currentUserRoleLevel=currentUserRoleLevel;
            this.sendCode=sendCode;
        }
        @Override
        public void run() {
            try{
                List<HealthEduArticleES> healthEduArticleESList = jmJkEduArticleService.savePCPushArticle(patientSet, sendCode, Integer.parseInt(sendType),"", teamCode, articleId,leaveWords,currentUserRole,currentUserRoleLevel);
                //发送任务到redis
            while (true) {
                try {
                    // 如果queue为空,则当前线程会堵塞,直到有新数据加入
                    JSONObject json = queue.take();
                    Set<String> patientSet = (Set<String>)json.get("patientSet");
                    String sendCode = json.get("patientSet")+"";
                    String sendType = json.get("sendType")+"";
                    Long teamCode = Long.valueOf(json.get("teamCode")+"");
                    String articleId = json.get("articleId")+"";
                    String leaveWords = json.get("leaveWords")+"";
                    String currentUserRole = json.get("currentUserRole")+"";
                    String currentUserRoleLevel = json.get("currentUserRoleLevel")+"";
                    List<HealthEduArticleES> healthEduArticleESList = jmJkEduArticleService.savePCPushArticle(patientSet, sendCode, Integer.parseInt(sendType),"", teamCode, articleId,leaveWords,currentUserRole,currentUserRoleLevel);
                    //发送任务到redis
                sender(healthEduArticleESList);
            }catch (Exception e){
                error(e);
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        }
    }
//    class HealthEduArticleESTask implements Runnable {
//        Set<String> patientSet;
//        String sendType;
//        Long teamCode;
//        String articleId;
//        String leaveWords;
//        String currentUserRole;
//        String currentUserRoleLevel;
//        String sendCode;
//        public HealthEduArticleESTask(Set<String> patientSet,String sendType,Long teamCode,String articleId,String leaveWords,String currentUserRole,String currentUserRoleLevel,String sendCode)  {
//            this.patientSet=patientSet;
//            this.sendType=sendType;
//            this.teamCode=teamCode;
//            this.articleId=articleId;
//            this.leaveWords=leaveWords;
//            this.currentUserRole=currentUserRole;
//            this.currentUserRoleLevel=currentUserRoleLevel;
//            this.sendCode=sendCode;
//        }
//        @Override
//        public void run() {
//            try{
//                List<HealthEduArticleES> healthEduArticleESList = jmJkEduArticleService.savePCPushArticle(patientSet, sendCode, Integer.parseInt(sendType),"", teamCode, articleId,leaveWords,currentUserRole,currentUserRoleLevel);
//                //发送任务到redis
//                sender(healthEduArticleESList);
//            }catch (Exception e){
//                error(e);
//            }
//        }
//    }
    @RequestMapping(value = "doctorSendArticleToSingle", method = RequestMethod.POST)

+ 3 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/synergy/SynergyManageController.java

@ -119,6 +119,8 @@ public class SynergyManageController extends BaseController {
                                @RequestParam(value = "isAcceptTask", required = true)Integer isAcceptTask,
                                @ApiParam(name = "keywords", value = "输入医生姓名、姓名、社保卡、身份证号码", required = false)
                                @RequestParam(value = "keywords", required = false)String keywords,
                                @ApiParam(name = "userType", value = "1、医生,4、医生管理员", required = true)
                                @RequestParam(value = "userType", required = true)Integer userType,
                                @ApiParam(name = "page", value = "第几页,从1开始", required = false)
                                @RequestParam(value = "page", required = false,defaultValue = "1")Integer page,
                                @ApiParam(name = "pageSize", value = "每页分页大小", required = false)
@ -127,7 +129,7 @@ public class SynergyManageController extends BaseController {
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            JSONObject result = manageSynergyService.workorderList(userCode,workorderType,status,serviceStartTime,serviceEndTime,isAcceptTask,keywords,page,pageSize);
            JSONObject result = manageSynergyService.workorderList(userCode,workorderType,status,serviceStartTime,serviceEndTime,isAcceptTask,keywords,userType,page,pageSize);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);