瀏覽代碼

客服系統

trick9191 7 年之前
父節點
當前提交
1b3309c892

+ 13 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/call/CallRecordDao.java

@ -0,0 +1,13 @@
package com.yihu.wlyy.repository.call;
import com.yihu.wlyy.entity.call.CallRecord;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2017/11/9.
 */
public interface CallRecordDao extends PagingAndSortingRepository<CallRecord, Long>, JpaSpecificationExecutor<CallRecord> {
    CallRecord findByCode(String code);
}

+ 18 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/call/CallServiceDao.java

@ -0,0 +1,18 @@
package com.yihu.wlyy.repository.call;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2017/11/9.
 */
public interface CallServiceDao extends PagingAndSortingRepository<CallService, Long>, JpaSpecificationExecutor<CallRecord> {
    List<CallService> findByCallCodeAndType(String callCode, Integer type);
    CallService findByCode(String code);
}

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/message/MessageDao.java

@ -97,4 +97,7 @@ public interface MessageDao extends PagingAndSortingRepository<Message, Long>, J
    //根据续方关联code查询团队长分配健管师消息
    @Query("from Message a where a.type = 8 and a.state=0 and a.del='1' and a.over='0' and relationCode = ?1  ")
    Message findByRelationCode(String relationCode);
    @Query("from Message a where a.type = 11 and a.state=0 and a.del='1' and a.over='0' and receiver = ?1  ")
    List<Message> findByReceiverCallService(String doctor);
}

+ 110 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java

@ -0,0 +1,110 @@
package com.yihu.wlyy.service.call;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.service.SignFamilyService;
import com.yihu.wlyy.repository.call.CallRecordDao;
import com.yihu.wlyy.repository.call.CallServiceDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class CustomerService extends BaseService{
	@Autowired
	private CallRecordDao callRecordDao;
	@Autowired
	private CallServiceDao callServiceDao;
	@Autowired
	private PatientDao patientDao;
	@Autowired
	private SignFamilyService familyService;
	@Autowired
	private JdbcTemplate jdbcTemplate;
	@Autowired
	private MessageDao messageDao;
	public List<Map<String,Object>> getCallServices(String keyword, Integer serverType,Integer state,String patientName,String ssc,String idCard,String doctorName,String code,Integer adminTeamCode ,String startDate,String endDate,Integer page,Integer size){
		String sql = "SELECT " +
				" s.`code`, " +
				" s.patient, " +
				" s.patient_name AS patientName, " +
				" s.doctor, " +
				" s.doctor_name AS doctorName, " +
				" s.server_type As serverType, " +
				" s.state, " +
				" s.server_content AS serverContent, " +
				" s.create_time AS createTime, " +
				" s.user, " +
				" s.user_name AS userName " +
				" FROM " +
				" manage_call_service s " +
				" WHERE " +
				" 1 = 1";
		if(StringUtils.isNotBlank(keyword)){
			sql +=" AND (s.patient_name = '"+keyword+"' OR s.ssc ='"+keyword+"' OR s.Idcard ='"+keyword+"')";
		}
		if(serverType!=null){
			sql += " AND s.server_type ='"+serverType+"' " ;
		}
		if(state != null){
			sql +=" AND s.state ='"+state+"'";
		}
		if(StringUtils.isNotBlank(patientName)){
			sql +=" AND s.patient_name ='"+patientName+"'" ;
		}
		if(StringUtils.isNotBlank(ssc)){
			sql +=" AND s.ssc ='"+ssc+"'" ;
		}
		if(StringUtils.isNotBlank(idCard)){
			sql +=" AND s.IdCard ='"+idCard+"'" ;
		}
		if(StringUtils.isNotBlank(doctorName)){
			sql +=" AND s.doctor_name ='"+doctorName+"'" ;
		}
		if(StringUtils.isNotBlank(code)){
			sql +=" AND s.code ='"+code+"'" ;
		}
		if(StringUtils.isNotBlank(startDate)){
			sql +=" AND s.create_time >='"+startDate+" 00:00:00'" ;
		}
		if(StringUtils.isNotBlank(endDate)){
			sql +=" AND s.create_time <='"+endDate+" 23:59:59'" ;
		}
		if(adminTeamCode!=null){
			sql +=" AND s.admin_team_code ="+adminTeamCode ;
		}
		sql += " LIMIT "+(page-1)*size+","+size +" ORDER BY r.create_time DESC";
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		return list;
	}
	public List<Message> getCallServiceMes(String doctor){
		List<Message> mes =  messageDao.findByReceiverCallService(doctor);
		return mes;
	}
}

+ 59 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java

@ -0,0 +1,59 @@
package com.yihu.wlyy.web.doctor.call;
import com.yihu.wlyy.service.call.CustomerService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * Created by Trick on 2017/11/14.
 */
@Controller
@RequestMapping(value = "/doctor/pcCustomer", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "客服系统")
public class CallRecordController extends BaseController {
    @Autowired
    private CustomerService customerService;
    @RequestMapping(value = "/getCallServices", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "协同服务查询")
    public String getCallServices(@ApiParam(name="keyword",value="姓名或身份证或医保卡号")@RequestParam(required = false)String keyword,
                                  @ApiParam(name="serverType",value="服务类型:0.医生咨询,1.预约挂号")@RequestParam(required = false)Integer serverType,
                                  @ApiParam(name="state",value="订单状态:0.草稿,1.待处理,2.完成")@RequestParam(required = false)Integer state,
                                  @ApiParam(name="patientName",value="患者姓名")@RequestParam(required = false)String patientName,
                                  @ApiParam(name="ssc",value="医保卡号")@RequestParam(required = false)String ssc,
                                  @ApiParam(name="idCard",value="身份证号")@RequestParam(required = false)String idCard,
                                  @ApiParam(name="doctorName",value="医生姓名")@RequestParam(required = false)String doctorName,
                                  @ApiParam(name="code",value="服务编号")@RequestParam(required = false)String code,
                                  @ApiParam(name="adminTeamCode",value="签约医生团队团队")@RequestParam(required = false)Integer adminTeamCode,
                                  @ApiParam(name="startDate",value="开始时间")@RequestParam(required = false)String startDate,
                                  @ApiParam(name="endDate",value="结束时间")@RequestParam(required = false)String endDate,
                                  @ApiParam(name="page",value="第几页,从1开始")@RequestParam(required = true)Integer page,
                                  @ApiParam(name="size",value="每页大小")@RequestParam(required = true)Integer size){
        try {
            return write(200,"保存成功","data",customerService.getCallServices(keyword, serverType,state,patientName,ssc,idCard,doctorName, code,adminTeamCode,startDate, endDate, page, size));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
    @RequestMapping(value = "/getCallServiceMes", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "获取协同服务消息")
    public String getCallServiceMes(){
        try {
            return write(200,"保存成功","data",customerService.getCallServiceMes(getUID()));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
}