Quellcode durchsuchen

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

huangwenjie vor 6 Jahren
Ursprung
Commit
e6636bbf1f

+ 2 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java

@ -277,10 +277,10 @@ public class CustomerController extends BaseController {
    @ApiOperation(value = "获取通讯记录详情")
    public String getCallRecordInfo(@ApiParam(name="code",value="通话记录code")@RequestParam(required = true)String code){
        try {
            return write(200,"查询成功","data",customerService.getCallRecordInfo(code));
            return write(200,"查询成功!","data",customerService.getCallRecordInfo(code));
        }catch (Exception e){
            error(e);
            return error(-1,"查询失败");
            return error(-1,"查询失败!");
        }
    }

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

@ -243,9 +243,12 @@ public class CustomerSynergyManageController extends BaseController {
    public String saveCallLabel(@ApiParam(name="callCode",value="通话记录code")@RequestParam(value = "callCode")String callCode,
                                @ApiParam(name="callLabels",value="通话标签,多个用逗号隔开")@RequestParam(value = "callLabels",required = false)String callLabels){
        try{
            String sql ="UPDATE manage_call_record SET call_label='"+callLabels+"' WHERE `code`='"+callCode+"'";
            jdbcTemplate.update(sql);
            return write(200,"保存成功!");
            int result = synergyManageService.saveCallLabel(callLabels,callCode);
            if (result>0){
                return write(200,"保存成功!");
            }else {
                return write(-1,"保存失败!");
            }
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败!");
@ -254,7 +257,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "getCallInfo",method = RequestMethod.GET)
    @ApiOperation(value = "获取通话的详情")
    public String getCallTypeAndContent(@ApiParam(name="callCode",value="通话记录code")@RequestParam(required = false)String callCode){
    public String getCallTypeAndContent(@ApiParam(name="callCode",value="通话记录code")@RequestParam(value ="callCode")String callCode){
        try{
            CallRecord callRecord = callRecordDao.findByCode(callCode);
            return write(200,"查询成功!","data",callCode);
@ -270,9 +273,12 @@ public class CustomerSynergyManageController extends BaseController {
                                @ApiParam(name="serviceType",value="服务类型,多个用逗号隔开")@RequestParam(value = "serviceType",required = false)String serviceType,
                               @ApiParam(name="serviceContent",value="服务记录")@RequestParam(value = "serviceContent",required = false)String serviceContent){
        try{
            String sql ="UPDATE manage_call_record SET service_type='"+serviceType+"',service_content='"+serviceContent+"' WHERE `code`='"+callCode+"'";
            jdbcTemplate.update(sql);
            return write(200,"保存成功!");
            int result = synergyManageService.saveCallInfo(serviceType,serviceContent,callCode);
            if (result>0){
                return write(200,"保存成功!");
            }else {
                return write(-1,"保存失败!");
            }
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败!");
@ -309,6 +315,18 @@ public class CustomerSynergyManageController extends BaseController {
        }
    }
    @RequestMapping(value = "customerIndex",method = RequestMethod.GET)
    @ApiOperation(value = "客服首页")
    public String customerIndex(@ApiParam(name="userCode",value="客服code")@RequestParam(value ="userCode")String userCode){
        try{
            return write(200,"获取成功!");
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
    @RequestMapping(value = "exportWorkorder", method = RequestMethod.GET)
    @ApiOperation("客服系统-协同服务列表")
    public String exportWorkorder(@ApiParam(name = "userCode", value = "客服code", required = false)

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

@ -13,4 +13,9 @@ public interface ManageSynergyWorkorderCustomerLogDao extends PagingAndSortingRe
    @Query("select count(distinct l.callCode) from ManageSynergyWorkorderCustomerLogDO l where l.workorderServiceCode=?1 ")
    Integer callNumByWorkorder(String workorderServiceCode);
    @Query("select count(1) from ManageSynergyWorkorderCustomerLogDO cl where cl.workorderCode = ?1 and cl.createUserCode = ?2 and cl.status = 0")
    Integer findExceptionCount(String workorderCode, String customerCode);
    List<ManageSynergyWorkorderCustomerLogDO> findByCallCode(String callCode);
}

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

@ -0,0 +1,14 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderReserveConsultDO;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by zhangdan on 2018/10/11.
 */
public interface ManageSynergyWorkorderReserveConsultDao extends PagingAndSortingRepository<ManageSynergyWorkorderReserveConsultDO, Long> {
    List<ManageSynergyWorkorderReserveConsultDO> findByCallCode(String callCode);
}

+ 103 - 68
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java

@ -3,10 +3,14 @@ package com.yihu.wlyy.service.manager.account;
import com.yihu.wlyy.entity.*;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderCustomerLogDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderReserveConsultDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.repository.call.CallRecordDao;
import com.yihu.wlyy.repository.call.CallServiceDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderCustomerLogDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderReserveConsultDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.manager.family.FamilyMemberService;
@ -60,6 +64,8 @@ public class CustomerService extends BaseService{
	private DoctorDao doctorDao;
	@Autowired
	private PatientReservationDao patientReservationDao;
	@Autowired
	private SignFamilyDao signFamilyDao;
	@Value(("${doctorAssistant.api}")+"/wlyygc/doctor/message")
	private String messageApi;
@ -94,7 +100,23 @@ public class CustomerService extends BaseService{
				doctors.add(doctor);
			}
		}
		String labelSql="SELECT  DISTINCT CASE call_label WHEN '1' THEN '有待跟踪' WHEN '2' THEN '电话骚扰' WHEN '3' THEN '态度恶劣' END FROM manage_call_record mcr WHERE (caller_number='"+patient.getPhone()+"' OR caller_number='"+patient.getMobile()+"') AND type=1 AND call_label IS NOT NULL";
		String labelSql="SELECT DISTINCT" +
				" CASE call_label" +
				" WHEN '1' THEN" +
				" '有待跟踪'" +
				" WHEN '2' THEN" +
				" '电话骚扰'" +
				" WHEN '3' THEN" +
				" '态度恶劣'" +
				" END call_label" +
				" FROM" +
				" manage_call_record" +
				" WHERE" +
				" caller_number = '"+patient.getMobile()+"'" +
				" AND type = 1" +
				" AND call_label IS NOT NULL" +
				" AND call_label != ''" +
				" AND call_label != 'null'";
		List<Map<String,Object>> labelInfo = jdbcTemplate.queryForList(labelSql);
		resp.put("signInfo",signInfo);
		resp.put("doctors",doctors);
@ -391,84 +413,97 @@ public class CustomerService extends BaseService{
	public Map<String,Object> getCallRecordInfo(String code){
		CallRecord callRecord = callRecordDao.findByCode(code);
		/*List<CallService> consultService = callServiceDao.findByCallCodeAndType(code,0);
		List<CallService> orderService = callServiceDao.findByCallCodeAndType(code,1);*/
		String type="";
		String relationCode="";
		String sql="";
		List<Map<String,Object>> resultList = new ArrayList<>();
		//咨询
		if ("0".equals(type)){
			sql="SELECT " +
				" a.code as workCode," +
				" a.content, " +
				" a.`status`, " +
				" a.service_patient_name, " +
				" c.deal_type, " +
				" c.deal_content, " +
				" a.remark " +
		String sql ="SELECT " +
				" w.`code`, " +
				" w.`status` AS wordStatus, " +
				" s.service_patient_code, " +
				" s.service_patient_name, " +
				" w.content, " +
				" l.remark, " +
				" s.relation_code, " +
				" s.relation_code_name, " +
				" w.type, " +
				" s.`status` AS serviceStatus " +
				" FROM " +
				" manage_synergy_workorder_reserve_consult c " +
				" INNER JOIN ( " +
				" SELECT " +
				"  w.*, s.service_patient_name " +
				"  FROM " +
				"  manage_synergy_workorder w " +
				"  LEFT JOIN manage_synergy_workorder_servicer s ON w.`code` = s.workorder_code " +
				" ) a " +
				" manage_synergy_workorder_servicer_log l " +
				" LEFT JOIN manage_synergy_workorder w ON l.workorder_code = w.`code` " +
				" LEFT JOIN manage_synergy_workorder_servicer s ON l.workorder_service_code = s.`code` " +
				" WHERE " +
				" call_code = '"+code+"'";
			resultList = jdbcTemplate.queryForList(sql);
		}
		//健康教育
		if ("1".equals(type)){
		}
		//预约
		if ("2".equals(type)){
			sql="SELECT" +
					" a. CODE AS workCode," +
					" a.`status`," +
					" a.service_patient_name," +
					" c.order_hospital_name," +
					" c.order_dept_name," +
					" c.order_time" +
					"FROM" +
					" manage_synergy_workorder_reserve_consult c" +
					"INNER JOIN (" +
					" SELECT" +
					"  w.*, s.service_patient_name" +
					" FROM" +
					"  manage_synergy_workorder w" +
					" LEFT JOIN manage_synergy_workorder_servicer s ON w.`code` = s.workorder_code" +
					") a" +
					"WHERE" +
					" call_code = '"+code+"'";
			resultList = jdbcTemplate.queryForList(sql);
		}
		//随访
		if ("3".equals(type)){
				" l.call_code = '"+code+"'";
		}
		//问卷调查
		if ("4".equals(type)){
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		List<Map<String,Object>> consultList = new ArrayList<>();
		List<Map<String,Object>> followList = new ArrayList<>();
		List<PatientReservation> patientReservation = new ArrayList<>();
		List<Map<String,Object>> surveyList = new ArrayList<>();
		List<Map<String,Object>> screenList = new ArrayList<>();
		for (Map<String,Object> map : list){
			String type = String.valueOf(map.get("type"));
			String relationCode = String.valueOf(map.get("relation_code"));
			//获取家庭医生姓名
			SignFamily signFamily = signFamilyDao.findByPatient(String.valueOf(map.get("service_patient_code")));
			if (signFamily!=null){
				map.put("familyDoctorName",signFamily.getDoctorName());
			}
			map.put("mobile",callRecord.getCallerNumber());
			//咨询
			if ("0".equals(type)){
				String consultSql ="SELECT deal_type,deal_content FROM `manage_synergy_workorder_reserve_consult` WHERE call_code='"+code+"'";
				List<Map<String,Object>> clist = jdbcTemplate.queryForList(consultSql);
				for (Map<String,Object> cmap : clist){
					map.putAll(cmap);
				}
				consultList.add(map);
			}
			//健康教育
			if ("1".equals(type)){
		}
		//疾病筛查
		if ("5".equals(type)){
			sql="SELECT * FROM `wlyy_survey_screen_result` WHERE `code`='"+relationCode+"'";
			resultList = jdbcTemplate.queryForList(sql);
			}
			//预约
		    if ("2".equals(type)){
				patientReservation = patientReservationDao.findByCallCode(code);
			}
			//随访
			if ("3".equals(type)){
				String followSql ="SELECT followup_class FROM wlyy_followup where id="+relationCode;
				List<Map<String,Object>> flist = jdbcTemplate.queryForList(followSql);
				for (Map<String,Object> fmap : flist){
					map.putAll(fmap);
				}
				followList.add(map);
			}
			//问卷调查
			if ("4".equals(type)){
				String qsql="SELECT template_title FROM `wlyy_survey_question_result` WHERE `code`='"+relationCode+"'";
				List<Map<String,Object>> flist = jdbcTemplate.queryForList(qsql);
				for (Map<String,Object> fmap : flist){
					map.putAll(fmap);
				}
				surveyList.add(map);
			}
			//疾病筛查
			if ("5".equals(type)){
				String ssql="SELECT template_title,screen_result_score FROM `wlyy_survey_screen_result` WHERE `code`='"+relationCode+"'";
				List<Map<String,Object>> flist = jdbcTemplate.queryForList(ssql);
				for (Map<String,Object> fmap : flist){
					map.putAll(fmap);
				}
				screenList.add(map);
			}
		}
		List<PatientReservation> patientReservation = patientReservationDao.findByCallCode(code);
		;
		Map<String,Object> rs = new HashedMap();
		rs.put("callRecord",callRecord);
		/*rs.put("consultService",consultService);
		rs.put("orderService",orderService);*/
		rs.put("patientReservation",patientReservation);
		rs.put("consult",consultList);
		rs.put("follow",followList);
		rs.put("survey",surveyList);
		rs.put("screen",screenList);
		return rs;
	}

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

@ -1,6 +1,11 @@
package com.yihu.wlyy.service.synergy;
import com.yihu.wlyy.entity.*;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkordeReminderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderExecutorDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.entity.synergy.*;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.repository.synergy.*;
@ -10,10 +15,12 @@ import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.query.BaseJpaService;
import jxl.Workbook;
import jxl.write.*;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -1174,6 +1181,66 @@ public class SynergyManageService extends BaseJpaService {
        return list;
    }
    public int saveCallLabel(String callLabels,String callCode){
        String sql ="UPDATE manage_call_record SET call_label='"+callLabels+"' WHERE `code`='"+callCode+"'";
        return  jdbcTemplate.update(sql);
    }
    public int saveCallInfo(String serviceType,String serviceContent,String callCode){
        String sql ="UPDATE manage_call_record SET service_type='"+serviceType+"',service_content='"+serviceContent+"' WHERE `code`='"+callCode+"'";
        return  jdbcTemplate.update(sql);
    }
    public void customerIndex(String userCode){
        Map<String,Object> map = new HashMap<>();
        String today = DateUtil.dateToStrShort(new Date());
        String callSql ="SELECT * FROM manage_call_record WHERE user_code='"+userCode+"' and create_time>='"+today+" 00:00:00' and create_time<='"+today+" 23:59:59'";
        //今日外呼量
        List<CallRecord> waihudList = jdbcTemplate.query(callSql+" and type=2",new BeanPropertyRowMapper<>(CallRecord.class));
        int customerNoCount = 0;
        int hours = 0;
        int minutes = 0;
        int seconds = 0;
        for(CallRecord callRecord : waihudList){
            //求总时长
            if (callRecord.getAnswerStatus()==1){
                String talkTime = callRecord.getTalkTime();
                String[] talkTimeStr = talkTime.split(":");
                for (int i=0;i<talkTimeStr.length;i++){
                    if (i==0){
                        hours += Integer.valueOf(talkTimeStr[i]);
                    }
                    if (i==1){
                        minutes += Integer.valueOf(talkTimeStr[i]);
                    }
                    if (i==2){
                        seconds += Integer.valueOf(talkTimeStr[i]);
                    }
                }
            }
            //获取客户未接通数量
            if(callRecord.getAnswerStatus()==3){
                customerNoCount++;
            }
        }
        String avgTalkTime = "";
        seconds = hours*3600+minutes*60+seconds;
        avgTalkTime =seconds/3600+"时";
        if (seconds%3600==0){
           avgTalkTime +="0分0秒";
        }else {
           if (seconds%3600%60==0){
               avgTalkTime +=seconds%3600/60+"分0秒";
           }else {
               avgTalkTime +=seconds%3600/60+"分"+seconds%3600%60+"秒";
           }
        }
        map.put("waihuCount",waihudList.size());
        map.put("waihuCustomerNoCount",customerNoCount);
        map.put("waihuAvgTalkTime",avgTalkTime);
    }
    /**
     *
     * @param workorderCode

+ 3 - 3
patient-co-manage/wlyy-manage/src/main/resources/application.yml

@ -60,9 +60,9 @@ spring:
  profiles: dev
  datasource:
    wlyy:
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: root
      password: 123456
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: linzhou
      password: linzhou
    device:
      url: jdbc:mysql://172.19.103.77/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: root