浏览代码

通话记录详情

zd_123 6 年之前
父节点
当前提交
f23fc95bc9

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

@ -127,7 +127,7 @@ public class CustomerSynergyManageController extends BaseController {
                                @RequestParam(value = "status", required = false)Integer status,
                                @RequestParam(value = "status", required = false)Integer status,
                                @ApiParam(name = "priority", value = "工单优先级(0、普通,1、加急)", required = false)
                                @ApiParam(name = "priority", value = "工单优先级(0、普通,1、加急)", required = false)
                                @RequestParam(value = "priority", required = false)Integer priority,
                                @RequestParam(value = "priority", required = false)Integer priority,
                                @ApiParam(name = "timeout", value = "是否超时1、超时,null全部", required = false)
                                @ApiParam(name = "timeout", value = "是否超时1、超时,2、否超时,null全部", required = false)
                                @RequestParam(value = "timeout", required = false)Integer timeout,
                                @RequestParam(value = "timeout", required = false)Integer timeout,
                                @ApiParam(name = "workorderCode", value = "服务编号", required = false)
                                @ApiParam(name = "workorderCode", value = "服务编号", required = false)
                                @RequestParam(value = "workorderCode", required = false)String workorderCode,
                                @RequestParam(value = "workorderCode", required = false)String workorderCode,
@ -147,6 +147,10 @@ public class CustomerSynergyManageController extends BaseController {
                                @RequestParam(value = "userType", required = true)Integer userType,
                                @RequestParam(value = "userType", required = true)Integer userType,
                                @ApiParam(name = "isAcceptTask", value = "1、我接收到的任务,2、我派发的任务,3、待接收(客服管理员),4、已接收(客服管理员)", required = true)
                                @ApiParam(name = "isAcceptTask", value = "1、我接收到的任务,2、我派发的任务,3、待接收(客服管理员),4、已接收(客服管理员)", required = true)
                                @RequestParam(value = "isAcceptTask", required = true)Integer isAcceptTask,
                                @RequestParam(value = "isAcceptTask", required = true)Integer isAcceptTask,
                                @ApiParam(name = "userName", value = "需求方", required = false)
                                @RequestParam(value = "userName", required = false)String userName,
                                @ApiParam(name = "hospitalName", value = "所属机构", required = false)
                                @RequestParam(value = "hospitalName", required = false)String hospitalName,
                                @ApiParam(name = "page", value = "第几页,从1开始", required = true)
                                @ApiParam(name = "page", value = "第几页,从1开始", required = true)
                                @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                                @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                                @ApiParam(name = "pageSize", value = "每页分页大小", required = true)
                                @ApiParam(name = "pageSize", value = "每页分页大小", required = true)
@ -156,7 +160,7 @@ public class CustomerSynergyManageController extends BaseController {
                userCode = getUID();
                userCode = getUID();
            }
            }
            Map<String,Object> result = synergyManageService.workorderList(userCode,keywords,workorderType,isMyTask,status,priority,timeout,workorderCode,
            Map<String,Object> result = synergyManageService.workorderList(userCode,keywords,workorderType,isMyTask,status,priority,timeout,workorderCode,
                    principal,serviceStartTime,serviceEndTime,patientName,ssc,idcard,userType,isAcceptTask,page,pageSize);
                    principal,serviceStartTime,serviceEndTime,patientName,ssc,idcard,userType,isAcceptTask,userName,hospitalName,page,pageSize);
            return write(200, "获取成功", "data", result);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);

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

@ -58,7 +58,7 @@ public class DoctorSynergyManageController extends BaseController {
                userCode = getUID();
                userCode = getUID();
            }
            }
            Map<String,Object> result = synergyManageService.workorderList(userCode,null,workorderType,null,status,null,null,null,
            Map<String,Object> result = synergyManageService.workorderList(userCode,null,workorderType,null,status,null,null,null,
                    null,serviceStartTime,serviceEndTime,null,null,null,1,isAcceptTask,page,pageSize);
                    null,serviceStartTime,serviceEndTime,null,null,null,1,isAcceptTask,null,null,page,pageSize);
            return write(200, "获取成功", "data", result);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
@ -75,8 +75,8 @@ public class DoctorSynergyManageController extends BaseController {
            if(!StringUtils.isNotEmpty(userCode)){
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
                userCode = getUID();
            }
            }
            synergyManageService.reminder(workorderCode,userCode,1);
            return write(200, "请求成功");
            Integer reminderStatus = synergyManageService.reminder(workorderCode,userCode,1);
            return write(200, "请求成功","data",reminderStatus);
        }catch (Exception e){
        }catch (Exception e){
            error(e);
            error(e);
            return error(-1, "请求失败");
            return error(-1, "请求失败");

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

@ -13,4 +13,5 @@ import java.util.List;
public interface ManageSynergyWorkorderReminderDao extends PagingAndSortingRepository<ManageSynergyWorkordeReminderDO, Long> {
public interface ManageSynergyWorkorderReminderDao extends PagingAndSortingRepository<ManageSynergyWorkordeReminderDO, Long> {
    List<ManageSynergyWorkordeReminderDO> findByPrincipalCodeAndDealWith(String principalCode,Integer dealWith);
    List<ManageSynergyWorkordeReminderDO> findByPrincipalCodeAndDealWith(String principalCode,Integer dealWith);
    List<ManageSynergyWorkordeReminderDO> findByWorkorderCode(String workorderCode);
}
}

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

@ -11,6 +11,8 @@ import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.query.BaseJpaService;
import com.yihu.wlyy.util.query.BaseJpaService;
import jxl.Workbook;
import jxl.write.*;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -19,6 +21,8 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.*;
@ -92,8 +96,8 @@ public class SynergyManageService extends BaseJpaService {
     */
     */
    public Map<String,Object> workorderList(String code,String keywords,Integer workorderType,
    public Map<String,Object> workorderList(String code,String keywords,Integer workorderType,
                               Integer isMyTask,Integer status,Integer priority,Integer timeout,String workorderCode,
                               Integer isMyTask,Integer status,Integer priority,Integer timeout,String workorderCode,
                               String principal,String serviceStartTime,String serviceEndTime,
                               String patientName,String ssc,String idcard,Integer userType,Integer isAcceptTask,Integer page, Integer pageSize) throws Exception{
                               String principal,String serviceStartTime,String serviceEndTime,String patientName,String ssc,String idcard,
                               Integer userType,Integer isAcceptTask,String userName,String hospitalName,Integer page, Integer pageSize) throws Exception{
        String servicerTable = " left join wlyy.manage_synergy_workorder_executor e on e.workorder_code=w.code AND e.del = 1  " ;
        String servicerTable = " left join wlyy.manage_synergy_workorder_executor e on e.workorder_code=w.code AND e.del = 1  " ;
        String whereSql = "";
        String whereSql = "";
@ -111,7 +115,7 @@ public class SynergyManageService extends BaseJpaService {
                whereSql += " and e.executor_code ='"+code+"' ";
                whereSql += " and e.executor_code ='"+code+"' ";
            }else if(isAcceptTask==2){//我派发
            }else if(isAcceptTask==2){//我派发
                whereSql +=" and w.create_user_type=2 ";//创建人为客服
                whereSql +=" and w.create_user_type=2 ";//创建人为客服
                whereSql += " and e.create_user ='"+code+"' ";
                whereSql += " and w.create_user ='"+code+"' ";
            }
            }
        }else if(userType==3){//医生
        }else if(userType==3){//医生
            if(isAcceptTask==1){//我接收
            if(isAcceptTask==1){//我接收
@ -148,7 +152,11 @@ public class SynergyManageService extends BaseJpaService {
        }
        }
        //是否超时
        //是否超时
        if(timeout!=null){
        if(timeout!=null){
            whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
            if(timeout==1){
                whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
            }else if(timeout==2){
                whereSql +=" and w.service_time <='"+DateUtil.dateToStrLong(new Date())+"' ";
            }
        }
        }
        //服务编码
        //服务编码
        if(StringUtils.isNotEmpty(workorderCode)){
        if(StringUtils.isNotEmpty(workorderCode)){
@ -167,15 +175,22 @@ public class SynergyManageService extends BaseJpaService {
        }
        }
        //服务对象
        //服务对象
        if(StringUtils.isNotEmpty(patientName)){
        if(StringUtils.isNotEmpty(patientName)){
            whereSql+=" s.service_patient_name like '%"+keywords+"%' ";
            whereSql+=" and s.service_patient_name like '%"+keywords+"%' ";
        }
        }
        //社保卡号
        //社保卡号
        if(StringUtils.isNotEmpty(ssc)){
        if(StringUtils.isNotEmpty(ssc)){
            whereSql+=" s.ssc like '%"+keywords+"%' ";
            whereSql+=" and s.ssc like '%"+keywords+"%' ";
        }
        }
        //身份证号
        //身份证号
        if(StringUtils.isNotEmpty(idcard)){
        if(StringUtils.isNotEmpty(idcard)){
            whereSql+=" s.idcard like '%"+keywords+"%' ";
            whereSql+=" and s.idcard like '%"+keywords+"%' ";
        }
        //需求方
        if(StringUtils.isNotEmpty(userName)){
            whereSql+=" and w.create_user_name like '%"+userName+"%' ";
        }
        if(StringUtils.isNotEmpty(hospitalName)){
            whereSql+=" and w.hospital_name like '%"+hospitalName+"%' ";
        }
        }
        String sql =" select DISTINCT w.* from wlyy.manage_synergy_workorder w  " +servicerTable+
        String sql =" select DISTINCT w.* from wlyy.manage_synergy_workorder w  " +servicerTable+
@ -228,6 +243,8 @@ public class SynergyManageService extends BaseJpaService {
            map.put("managerName",managerName);//负责人的名称
            map.put("managerName",managerName);//负责人的名称
            Integer finishedServicerCount = workorderServicerDao.findByWorkorderCodeCount(one.get("code")+"",3);
            Integer finishedServicerCount = workorderServicerDao.findByWorkorderCodeCount(one.get("code")+"",3);
            map.put("finishedServicerCount",finishedServicerCount);//服务完成人数
            map.put("finishedServicerCount",finishedServicerCount);//服务完成人数
            map.put("userName",one.get("create_user_name"));
            map.put("hospitalName",one.get("hospital_name"));
            resultList.add(map);
            resultList.add(map);
        }
        }
        Map<String,Object> resultMap = new HashMap<>();
        Map<String,Object> resultMap = new HashMap<>();
@ -656,8 +673,12 @@ public class SynergyManageService extends BaseJpaService {
     * @throws Exception
     * @throws Exception
     */
     */
    @Transactional
    @Transactional
    public void reminder(String workorderCode,String userCode,Integer userType) throws Exception{
    public Integer reminder(String workorderCode,String userCode,Integer userType) throws Exception{
        Integer reminderStatus = reminderStatus(workorderCode);
        if(reminderStatus==3||reminderStatus==4){
            return reminderStatus;
        }
        ManageSynergyWorkorderDO manageSynergyWorkorderDO = workOrderDao.findByCode(workorderCode);
        ManageSynergyWorkorderDO manageSynergyWorkorderDO = workOrderDao.findByCode(workorderCode);
        if(manageSynergyWorkorderDO==null){
        if(manageSynergyWorkorderDO==null){
            throw new Exception();
            throw new Exception();
@ -693,6 +714,40 @@ public class SynergyManageService extends BaseJpaService {
        workordeReminderDO.setDealWith(0);
        workordeReminderDO.setDealWith(0);
        workordeReminderDO.setPriority(manageSynergyWorkorderDO.getPriority());
        workordeReminderDO.setPriority(manageSynergyWorkorderDO.getPriority());
        manageSynergyWorkorderReminderDao.save(workordeReminderDO);
        manageSynergyWorkorderReminderDao.save(workordeReminderDO);
        return reminderStatus;
    }
    public Integer reminderStatus(String workorderCode) throws Exception{
        Integer reminderStatus=4;//默认是不满足催单条件
        ManageSynergyWorkorderDO workorderDO = workOrderDao.findByCode(workorderCode);
        //工单状态(0、草稿,1、未接受,2、处理中,3、处理完成,4、退回)
        //1、当单子超过1小时扔未被接收或退回时
        //2、当单子被接收后,如果距离服务时间小于4小时,则允许用户进行催单操作。
        //3、当已催促过客服时,再次催单
        //4、不满足催单条件时
        List<ManageSynergyWorkordeReminderDO> list = manageSynergyWorkorderReminderDao.findByWorkorderCode(workorderCode);
        if(workorderDO.getStatus()==1){
            if(list.size()>0){
                reminderStatus=3;
            }else{
                //单子超过1小时
                long h1= 60*60*1000L;
                if(new Date().getTime()-workorderDO.getCreateTime().getTime()>h1){
                    reminderStatus=1;
                }
            }
        }else if(workorderDO.getStatus()==2){
            if(list.size()>0){
                reminderStatus=3;
            }else{
                //距离服务时间小于4小时
                long h4= 4*60*60*1000L;
                if(workorderDO.getServiceTime().getTime()-new Date().getTime()<h4){
                    reminderStatus=2;
                }
            }
        }
        return reminderStatus;
    }
    }
    /**
    /**
@ -747,39 +802,6 @@ public class SynergyManageService extends BaseJpaService {
        return resultList;
        return resultList;
    }
    }
    public List<Map<String,Object>> getDealList(String idcard){
        Patient patient = patientDao.findByIdcard(idcard);
        if (patient==null){
            return null;
        }
        String sql ="SELECT" +
                " s.create_time," +
                " s.service_patient_name," +
                " w.priority," +
                " w.relation_code," +
                " w.relation_code_name," +
                " w.create_user_type," +
                " w.create_user_name," +
                " w.create_user," +
                " w.remark," +
                " w.service_time" +
                " FROM" +
                " `manage_synergy_workorder_servicer` s" +
                " LEFT JOIN manage_synergy_workorder w ON s.workorder_code = w.`code`" +
                " WHERE" +
                " s.service_patient_code = '"+patient.getCode()+"'" +
                " AND s.`status` = 1" +
                " ORDER BY" +
                " s.create_time" +
                " LIMIT 2";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map : list){
            int isOver = isServiceOverTime(DateUtil.strToDate(String.valueOf(map.get("service_time")),DateUtil.YYYY_MM_DD_HH_MM_SS));
            map.put("isOver",isOver);
        }
        return list;
    }
    /**
    /**
     * 创建工单
     * 创建工单
     *
     *
@ -870,108 +892,186 @@ public class SynergyManageService extends BaseJpaService {
        return  jsonObject;
        return  jsonObject;
    }
    }
    public JSONObject getUnitLabels(String currentRoleCode) {
        String url = wlyyUrl + "/wlyygc/doctor/label/unitLabels?currentRoleCode=" + currentRoleCode + "&currentRoleLevel=3";
    public JSONObject getUnitLabels(String currentRoleCode, String currentRoleLevel) {
        String url = wlyyUrl + "/wlyygc/doctor/label/unitLabels?currentRoleCode=" + currentRoleCode + "&currentRoleLevel=" + currentRoleLevel;
        String response = httpClientUtil.get(url, "UTF-8");
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = new JSONObject(response);
        JSONObject jsonObject = new JSONObject(response);
        return  jsonObject;
        return  jsonObject;
    }
    }
    public List<Town> getTowns() {
        return (List<Town>) townDao.findAll();
    }
    public void exportWorkorder(String code,String keywords,Integer workorderType,
    public void exportWorkorder(String code,String keywords,Integer workorderType,
                                Integer isMyTask,Integer status,Integer priority,Integer timeout,String workorderCode,
                                Integer isMyTask,Integer status,Integer priority,Integer timeout,String workorderCode,
                                String principal,String serviceStartTime,String serviceEndTime,
                                String principal,String serviceStartTime,String serviceEndTime,
                                String patientName,String ssc,String idcard,Integer userType,Integer isAcceptTask){
        String servicerTable = " left join wlyy.manage_synergy_workorder_executor e on e.workorder_code=w.code AND e.del = 1  " ;
        String whereSql = "";
        if(userType==3){//客服管理员
            whereSql +=" and w.create_user_type=1 ";//创建人为医生
            if(isAcceptTask==3){//待接收
                whereSql +=" and w.status =1 ";
                servicerTable ="";
            }else if(isAcceptTask==4){//已接收
                whereSql +=" and w.status in (2,3) ";
            }
        }else if(userType==2){//客服
            if(isAcceptTask==1){//我接收
                                String patientName,String ssc,String idcard,Integer userType,Integer isAcceptTask,HttpServletResponse response) throws Exception{
        WritableWorkbook wwb = null;
        try{
            String servicerTable = " left join wlyy.manage_synergy_workorder_executor e on e.workorder_code=w.code AND e.del = 1  " ;
            String whereSql = "";
            if(userType==3){//客服管理员
                whereSql +=" and w.create_user_type=1 ";//创建人为医生
                whereSql +=" and w.create_user_type=1 ";//创建人为医生
                whereSql += " and e.executor_code ='"+code+"' ";
            }else if(isAcceptTask==2){//我派发
                whereSql +=" and w.create_user_type=2 ";//创建人为客服
                whereSql += " and e.create_user ='"+code+"' ";
                if(isAcceptTask==3){//待接收
                    whereSql +=" and w.status =1 ";
                    servicerTable ="";
                }else if(isAcceptTask==4){//已接收
                    whereSql +=" and w.status in (2,3) ";
                }
            }else if(userType==2){//客服
                if(isAcceptTask==1){//我接收
                    whereSql +=" and w.create_user_type=1 ";//创建人为医生
                    whereSql += " and e.executor_code ='"+code+"' ";
                }else if(isAcceptTask==2){//我派发
                    whereSql +=" and w.create_user_type=2 ";//创建人为客服
                    whereSql += " and e.create_user ='"+code+"' ";
                }
            }else if(userType==3){//医生
                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=2 ";//创建人为医生
                    whereSql += " and e.create_user ='"+code+"' ";
                }
            }
            }
        }else if(userType==3){//医生
            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=2 ";//创建人为医生
                whereSql += " and e.create_user ='"+code+"' ";
            //关键字查询
            if(StringUtils.isNotEmpty(keywords)){
                servicerTable +=" left join wlyy.manage_synergy_workorder_servicer s on s.workorder_code=w.code ";
                whereSql += " and w.servicer_count<=10  ";
                whereSql += " and (w.create_user_name like '%"+keywords+"%' or s.service_patient_name like '%"+keywords+"%' " +
                        " or s.ssc like '%"+keywords+"%' or s.idcard like '%"+keywords+"%' ) ";
            }
            }
        }
            //服务类型
            if(workorderType!=null){
                whereSql += " and w.type ="+workorderType+" ";
            }
            //是否是我负责的
            if(isMyTask!=null){
                whereSql += " and e.executor_code ='"+code+"' and e.executor_type=1 ";
            }
            //工单状态
            if(status!=null){
                whereSql +=" and w.status ="+status+" ";
            }
            //优先级
            if(priority!=null){
                whereSql+= " and w.priority="+priority+" ";
            }
            //是否超时
            if(timeout!=null){
                whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
            }
            //服务编码
            if(StringUtils.isNotEmpty(workorderCode)){
                whereSql+=" and w.code like '%"+workorderCode+"%' ";
            }
            //负责人
            if(StringUtils.isNotEmpty(principal)){
                whereSql+=" and e.code like '%"+principal+"%' and e.executor_type=1 ";
            }
            //服务时间
            if(StringUtils.isNotEmpty(serviceStartTime)){
                whereSql+=" and w.service_time>='"+serviceStartTime+"' ";
            }
            if(StringUtils.isNotEmpty(serviceEndTime)){
                whereSql+=" and w.service_time<='"+serviceEndTime+"' ";
            }
            //服务对象
            if(StringUtils.isNotEmpty(patientName)){
                whereSql+=" s.service_patient_name like '%"+keywords+"%' ";
            }
            //社保卡号
            if(StringUtils.isNotEmpty(ssc)){
                whereSql+=" s.ssc like '%"+keywords+"%' ";
            }
            //身份证号
            if(StringUtils.isNotEmpty(idcard)){
                whereSql+=" s.idcard like '%"+keywords+"%' ";
            }
            String sql =" select DISTINCT w.* from wlyy.manage_synergy_workorder w  " +servicerTable+
        //关键字查询
        if(StringUtils.isNotEmpty(keywords)){
            servicerTable +=" left join wlyy.manage_synergy_workorder_servicer s on s.workorder_code=w.code ";
            whereSql += " and w.servicer_count<=10  ";
            whereSql += " and (w.create_user_name like '%"+keywords+"%' or s.service_patient_name like '%"+keywords+"%' " +
                    " or s.ssc like '%"+keywords+"%' or s.idcard like '%"+keywords+"%' ) ";
        }
        //服务类型
        if(workorderType!=null){
            whereSql += " and w.type ="+workorderType+" ";
        }
        //是否是我负责的
        if(isMyTask!=null){
            whereSql += " and e.executor_code ='"+code+"' and e.executor_type=1 ";
        }
        //工单状态
        if(status!=null){
            whereSql +=" and w.status ="+status+" ";
        }
        //优先级
        if(priority!=null){
            whereSql+= " and w.priority="+priority+" ";
        }
        //是否超时
        if(timeout!=null){
            whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
        }
        //服务编码
        if(StringUtils.isNotEmpty(workorderCode)){
            whereSql+=" and w.code like '%"+workorderCode+"%' ";
        }
        //负责人
        if(StringUtils.isNotEmpty(principal)){
            whereSql+=" and e.code like '%"+principal+"%' and e.executor_type=1 ";
        }
        //服务时间
        if(StringUtils.isNotEmpty(serviceStartTime)){
            whereSql+=" and w.service_time>='"+serviceStartTime+"' ";
        }
        if(StringUtils.isNotEmpty(serviceEndTime)){
            whereSql+=" and w.service_time<='"+serviceEndTime+"' ";
        }
        //服务对象
        if(StringUtils.isNotEmpty(patientName)){
            whereSql+=" s.service_patient_name like '%"+keywords+"%' ";
        }
        //社保卡号
        if(StringUtils.isNotEmpty(ssc)){
            whereSql+=" s.ssc like '%"+keywords+"%' ";
                    " where w.del=1  " +
                    " and 1=1 "+whereSql+ " order by w.priority desc,w.service_time desc";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            //生成excel
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "patientHealthIndexDataList.xls"));
            OutputStream os = response.getOutputStream();
            wwb = Workbook.createWorkbook(os);
            WritableSheet ws = Workbook.createWorkbook(os).createSheet("sheet",1);
            String[] header = {"SN码","创建日期","身份证号","姓名","数据类型","value1","value2","value3","value4","value5","value6","value7"};
            int i = 0;
            for (String h : header) {
                Label label = new Label(0, i, h);
                ws.addCell(label);
                i++;
            }
            for(Map<String,Object> one:list){
//                addCell(ws, i, 0, m.getDeviceSn(),"");
//                addCell(ws, i, 1, format.format(m.getCzrq()),"");
//                addCell(ws, i, 2, m.getIdcard(),"");
//                addCell(ws, i, 3, m.getUserName(),"");
//                addCell(ws, i, 4, type,"");
//                addCell(ws, i, 5, m.getValue1(),"");
//                addCell(ws, i, 6, m.getValue2(),"");
//                addCell(ws, i, 7, m.getValue3(),"");
//                addCell(ws, i, 8, m.getValue4(),"");
//                addCell(ws, i, 9, m.getValue5(),"");
//                addCell(ws, i, 10, m.getValue6(),"");
//                addCell(ws, i, 11, m.getValue7(),"");
                i++;
            }
            wwb.write();
            wwb.close();
        }catch (Exception e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
        }
        //身份证号
        if(StringUtils.isNotEmpty(idcard)){
            whereSql+=" s.idcard like '%"+keywords+"%' ";
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
        Label label = new Label(column ,row, data);
        if(!org.springframework.util.StringUtils.isEmpty(memo)){
            WritableCellFeatures cellFeatures = new WritableCellFeatures();
            cellFeatures.setComment(memo);
            label.setCellFeatures(cellFeatures);
        }
        }
        String sql =" select DISTINCT w.* from wlyy.manage_synergy_workorder w  " +servicerTable+
        ws.addCell(label);
    }
                " where w.del=1  " +
                " and 1=1 "+whereSql+ " order by w.priority desc,w.service_time desc";
    public List<Map<String,Object>> getDealList(String idcard){
        Patient patient = patientDao.findByIdcard(idcard);
        if (patient==null){
            return null;
        }
        String sql ="SELECT" +
                " s.create_time," +
                " s.service_patient_name," +
                " w.priority," +
                " w.relation_code," +
                " w.relation_code_name," +
                " w.create_user_type," +
                " w.create_user_name," +
                " w.create_user," +
                " w.remark," +
                " w.service_time" +
                " FROM" +
                " `manage_synergy_workorder_servicer` s" +
                " LEFT JOIN manage_synergy_workorder w ON s.workorder_code = w.`code`" +
                " WHERE" +
                " s.service_patient_code = '"+patient.getCode()+"'" +
                " AND s.`status` = 1" +
                " ORDER BY" +
                " s.create_time" +
                " LIMIT 2";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map : list){
            int isOver = isServiceOverTime(DateUtil.strToDate(String.valueOf(map.get("service_time")),DateUtil.YYYY_MM_DD_HH_MM_SS));
            map.put("isOver",isOver);
        }
        return list;
    }
    }
}
}

+ 4 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/wechat/WechatService.java

@ -56,7 +56,8 @@ public class WechatService extends BaseService {
					"a.mobile," +
					"a.mobile," +
					"t.openid_time," +
					"t.openid_time," +
					"t.medicare_number,"+
					"t.medicare_number,"+
					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
//					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
					"a.idcard, " +
					"a.doctor_name," +
					"a.doctor_name," +
					"a.doctor_health_name," +
					"a.doctor_health_name," +
					"t.sick_village_name," +
					"t.sick_village_name," +
@ -79,7 +80,8 @@ public class WechatService extends BaseService {
					"a.openid_time," +
					"a.openid_time," +
					"a.openid, " +
					"a.openid, " +
					"a.medicare_number," +
					"a.medicare_number," +
					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
//					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
					"a.idcard, " +
					"b.doctor_name," +
					"b.doctor_name," +
					"b.doctor_health_name," +
					"b.doctor_health_name," +
					"b.hospital_name," +
					"b.hospital_name," +

+ 7 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java

@ -312,9 +312,13 @@ public class SurveyScreenResultService extends BaseService {
            Map<String, Object> map = new HashMap<>();
            Map<String, Object> map = new HashMap<>();
            map.put("question", surveyTemplateQuestions);
            map.put("question", surveyTemplateQuestions);
            String qusCode = surveyTemplateQuestions.getCode();
            String qusCode = surveyTemplateQuestions.getCode();
            for (Map<String, Object> option : optionAnswersList) {
                if (option.get("question_code").equals(qusCode)) {
                    map.put("option", option);
            if (optionAnswersList==null || optionAnswersList.size()==0){
                map.put("option",new HashMap<String,Object>());
            }else {
                for (Map<String, Object> option : optionAnswersList) {
                    if (option.get("question_code").equals(qusCode)) {
                        map.put("option", option);
                    }
                }
                }
            }
            }
            answerMap.put(surveyTemplateQuestions.getSort() + "", map);
            answerMap.put(surveyTemplateQuestions.getSort() + "", map);

+ 174 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/ManageSynergyService.java

@ -0,0 +1,174 @@
package com.yihu.wlyy.service.synergy;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.followup.Followup;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.followup.FollowUpDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
 * Created by humingfen on 2018/10/9.
 */
@Service
@Transactional
public class ManageSynergyService extends BaseService {
    @Value("${customerService.url}")
    private String customerUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private FollowUpDao followUpDao;
    @Autowired
    private HospitalDao hospitalDao;
    public JSONObject getWorkOrderInfo(String workorderCode, String patient, Integer role) throws Exception {
        Map<String, Object> param = new HashedMap();
        param.put("workorderCode", workorderCode);
        param.put("patient", patient);
        param.put("role", role);
        HttpResponse response = null;
        response = HttpUtils.doPost(customerUrl + "synergy/customer/getWorkOrderInfo", param);
        JSONObject rs = new JSONObject(response.getContent());
        return rs;
    }
    public String createWorkorder(String doctor, Set<String> patientSet, Integer type, String objectId, String serviceDate, Integer priority, String remark, String followupClass, String followupType){
        String response = null;
        JSONArray array = new JSONArray();
        String patientCode1 = null;
        Doctor doctor1 = doctorDao.findByCode(doctor);
        for (String patientCode:patientSet){
            if (patientSet.size() == 1){
                patientCode1 = patientCode;
            }
            Patient patient = patientDao.findByCode(patientCode);
            com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
            object.put("servicePatientCode",patient.getCode());
            object.put("servicePatientName",patient.getName());
            object.put("ssc",patient.getSsc());
            object.put("idcard",patient.getIdcard());
            object.put("mobile",patient.getMobile());
            object.put("hospital",doctor1.getHospital());
            object.put("hospitalName",doctor1.getHospitalName());
            Hospital hospital = hospitalDao.findByCode(doctor1.getHospital());
            object.put("town", hospital.getTown());
            object.put("townName",hospital.getTownName());
            array.add(object);
        }
        com.alibaba.fastjson.JSONObject object = new com.alibaba.fastjson.JSONObject();
        object.put("type",type);
        object.put("serviceTime",serviceDate);
        object.put("priority",priority);
        object.put("createUser",doctor1.getCode());
        object.put("createUserName",doctor1.getName());
        object.put("hospital",doctor1.getHospital());
        object.put("hospitalName",doctor1.getHospitalName());
        object.put("createUserType",1);
        object.put("remark",remark);
        if (type == 3){
            Followup followup = new Followup();
            followup.setDoctorCode(doctor1.getCode());
            followup.setDoctorName(doctor1.getName());
            if (patientCode1 != null){
                Patient patient1 = patientDao.findByCode(patientCode1);
                followup.setPatientCode(patient1.getCode());
                followup.setPatientName(patient1.getName());
                followup.setIdcard(patient1.getIdcard());
                SignFamily signFamily = signFamilyDao.findByPatient(patientCode1);
                followup.setAdminTeamCode(signFamily.getAdminTeamId());
                followup.setSignType(Integer.parseInt(signFamily.getSignType()));
                followup.setSignCode(signFamily.getCode());
            }
            followup.setFollowupDate(DateUtil.strToDate(serviceDate));
            followup.setFollowupType(followupType);
            followup.setFollowupClass(followupClass);
            followup.setOrgCode(doctor1.getHospital());
            followup.setOrgName(doctor1.getHospitalName());
            followup.setDataFrom("2");
            followup.setStatus("2");
            followup.setCreater(doctor1.getCode());
            followup.setCreateTime(new Date());
            followup = followUpDao.save(followup);
            object.put("relationCode",followup.getId());
            object.put("relationCodeName","随访");
        }else if (type == 1){
            object.put("relationCode",objectId);
            object.put("relationCodeName","健康教育");
        }else if (type == 5){
            object.put("relationCode",objectId);
            object.put("relationCodeName","疾病筛查");
        }
        String url = customerUrl + "followup/saveFollowupProjectData";
        Map<String, String> params = new HashMap<>();
        params.put("servicers",array.toJSONString());
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response;
    }
    public JSONObject workorderList(String userCode,Integer workorderType,Integer status,String serviceStartTime,String serviceEndTime,Integer isAcceptTask,Integer page,Integer pageSize) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("userCode",userCode);
        param.put("workorderType",workorderType);
        param.put("status",status);
        param.put("serviceStartTime",serviceStartTime);
        param.put("serviceEndTime",serviceEndTime);
        param.put("isAcceptTask",isAcceptTask);
        param.put("page",page);
        param.put("pageSize",pageSize);
        HttpResponse response = HttpUtils.doGet(customerUrl + "/doctor/synergy/workorderList", param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
            JSONObject json = result.getJSONObject("data");
            return json;
        }
        throw new Exception("请求客服系统服务失败!");
    }
    public Integer reminder(String userCode,String workorderCode) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("userCode",userCode);
        param.put("workorderCode",workorderCode);
        HttpResponse response = HttpUtils.doPost(customerUrl + "/synergy/doctor/reminder", param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
            Integer reminderStatus = (Integer) result.get("data");
            return reminderStatus;
        }
        throw new Exception("请求客服系统服务失败!");
    }
}