Browse Source

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

trick9191 7 years ago
parent
commit
24975f9165

+ 8 - 5
common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.entity.call;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
@ -33,7 +34,7 @@ public class CallRecord extends IdEntity {
    private String  ssc; //社保卡号
    private String  doctor; //签约医生code
    private String  doctorName; //签约医生姓名
    private String  adminTeamCode; //签约医生团队
    private Long  adminTeamCode;
    public String getCode() {
        return code;
@ -82,7 +83,7 @@ public class CallRecord extends IdEntity {
    public void setServiceContent(String serviceContent) {
        this.serviceContent = serviceContent;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
@ -90,7 +91,7 @@ public class CallRecord extends IdEntity {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getEndTime() {
        return endTime;
    }
@ -99,6 +100,7 @@ public class CallRecord extends IdEntity {
        this.endTime = endTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
@ -107,6 +109,7 @@ public class CallRecord extends IdEntity {
        this.updateTime = updateTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCallTime() {
        return callTime;
    }
@ -195,11 +198,11 @@ public class CallRecord extends IdEntity {
        this.type = type;
    }
    public String getAdminTeamCode() {
    public Long getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(String adminTeamCode) {
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
}

+ 8 - 13
common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.entity.call;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
@ -15,7 +16,6 @@ public class CallService extends IdEntity {
    private String code; //服务编号
    private String callCode; //关联通话记录
    private Integer serverType; //服务类型:0.医生咨询,1.预约挂号
    private String patient; //服务对象(患者code)
    private String patientName; // 服务对象名称(患者名称)
    private String ssc; // 社保卡号
@ -28,7 +28,7 @@ public class CallService extends IdEntity {
    private Date createTime; //创建时间
    private Date updateTime; //更新时间
    private String remark; //备注
    private Integer type; //服务类型:0.咨询,2.预约
    private Integer type; //服务类型:0.咨询,1.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
@ -43,7 +43,7 @@ public class CallService extends IdEntity {
    private String orderTime; //预约时间段
    private String user; //创建人
    private String userName; //创建人
    private String adminTeamCode; //团队id
    private Long adminTeamCode; //团队id
    public String getCode() {
        return code;
@ -61,14 +61,6 @@ public class CallService extends IdEntity {
        this.callCode = callCode;
    }
    public Integer getServerType() {
        return serverType;
    }
    public void setServerType(Integer serverType) {
        this.serverType = serverType;
    }
    public String getPatient() {
        return patient;
    }
@ -141,6 +133,7 @@ public class CallService extends IdEntity {
        this.state = state;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
@ -149,6 +142,7 @@ public class CallService extends IdEntity {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
@ -181,6 +175,7 @@ public class CallService extends IdEntity {
        this.dealType = dealType;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getDealTime() {
        return dealTime;
    }
@ -285,11 +280,11 @@ public class CallService extends IdEntity {
        this.user = user;
    }
    public String getAdminTeamCode() {
    public Long getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(String adminTeamCode) {
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java

@ -29,7 +29,7 @@ public class SwaggerConfig extends WebMvcConfigurerAdapter {
                .forCodeGeneration(true)
                .pathMapping("/")
                .select()
                .paths(PathSelectors.regex("/customer/.*"))
                .paths(PathSelectors.any())
                .build()
                .apiInfo(patientApiInfo());
    }

+ 10 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/WebMvcConfig.java

@ -5,6 +5,7 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
@ -17,6 +18,15 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
        configurer.enable();
    }
    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry){
        super.addResourceHandlers(registry);
        registry.addResourceHandler("swagger-ui.html")
                .addResourceLocations("classpath:/META-INF/resources/");
        registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
    }
    @Bean
    public InternalResourceViewResolver viewResolver() {
        InternalResourceViewResolver resolver = new InternalResourceViewResolver();

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

@ -205,11 +205,9 @@ public class CustomerController extends BaseController {
    public String addCallRecord(@ApiParam(name="type",value="1.呼入,2.呼出")@RequestParam(required = true)Integer type,
                                 @ApiParam(name="callerNumber",value="呼入号码")@RequestParam(required = true)String callerNumber,
                                 @ApiParam(name="recipientNumber",value="接收号码")@RequestParam(required = true)String recipientNumber,
                                 @ApiParam(name="status",value="接听状态: 1.接通,2. 队列中放弃,3.接通")@RequestParam(required = true)Integer status,
                                 @ApiParam(name="serviceType",value="服务类型")@RequestParam(required = true)Integer serviceType,
                                 @ApiParam(name="serviceContent",value="服务内容")@RequestParam(required = false)String serviceContent){
                                 @ApiParam(name="status",value="接听状态: 1.接通,2. 队列中放弃,3.接通")@RequestParam(required = true)Integer status){
        try {
            return write(200,"保存成功","data",customerService.addCallRecord( getUID(), type, callerNumber, recipientNumber, status, serviceType, serviceContent));
            return write(200,"保存成功","data",customerService.addCallRecord( getUID(), type, callerNumber, recipientNumber, status));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
@ -228,11 +226,25 @@ public class CustomerController extends BaseController {
        }
    }
    @RequestMapping(value = "/updateCallRecordService", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "更新通话记录的服务记录信息")
    public String  updateCallRecordService(@ApiParam(name="code",value="通话记录code")@RequestParam(required = true)String code,
                                           @ApiParam(name="phone",value="服务对象电话号码")@RequestParam(required = true)String phone,
                                           @ApiParam(name="serviceType",value="服务类型:1.医生转接 2.代理咨询")@RequestParam(required = true)Integer serviceType,
                                           @ApiParam(name="serviceContent",value="服务内容")@RequestParam(required = false) String serviceContent){
        try {
            return write(200,"保存成功","data",customerService.updateCallRecordService(code,phone,serviceType,serviceContent));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
    @RequestMapping(value = "/updateCallRecordEndTime", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "更新电话记录(更新结束时间)")
    public String  updateCallRecordEndTime(@ApiParam(name="jsonString",value="保存实体json串")@RequestParam(required = true)String jsonString){
    public String  updateCallRecordEndTime(@ApiParam(name="code",value="电话记录code")@RequestParam(required = true)String code){
        try {
            return write(200,"保存成功","data",customerService.updateCallRecordEndTime(jsonString));
            return write(200,"保存成功","data",customerService.updateCallRecordEndTime(code));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
@ -242,17 +254,17 @@ public class CustomerController extends BaseController {
    @RequestMapping(value = "/getCallRecords", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "获取通讯记录列表")
    public String getCallRecords(@ApiParam(name="callerNumber",value="呼叫人电话")@RequestParam(required = false)String callerNumber,
                                 @ApiParam(name="answerStatus",value="接听状态: 1.接通,2. 队列中放弃,3.接通")@RequestParam(required = false)Integer answerStatus,
                                 @ApiParam(name="answerStatus",value="接听状态: 1.接通,2. 队列中放弃,3.未接通")@RequestParam(required = false)Integer answerStatus,
                                 @ApiParam(name="serviceType",value="服务类型:0.医生咨询,1.预约挂号")@RequestParam(required = false)Integer serviceType ,
                                 @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.getCallRecords(callerNumber,answerStatus,serviceType,startDate,endDate,page,size));
            return write(200,"查询成功","data",customerService.getCallRecords(callerNumber,answerStatus,serviceType,startDate,endDate,page,size));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
            return error(-1,"查询失败");
        }
    }
@ -260,10 +272,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,"查询失败");
        }
    }
@ -271,16 +283,16 @@ public class CustomerController extends BaseController {
    @ApiOperation(value = "获取协同服务编号")
    public String getCallServiceCode(@ApiParam(name="type",value="协同服务类型编号,1为咨询 2为待预约")@RequestParam(required = true)String type){
        try {
            return write(200,"保存成功","data",customerService.getCallServiceCode(type));
            return write(200,"查询成功","data",customerService.getCallServiceCode(type));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
            return error(-1,"查询失败");
        }
    }
    @RequestMapping(value = "/saveCallService", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "保存协同服务")
    public String saveCallService(@ApiParam(name="type",value="协同服务json串")@RequestParam(required = true)String callServiceJson){
    public String saveCallService(@ApiParam(name="callServiceJson",value="协同服务json串")@RequestParam(required = true)String callServiceJson){
        try {
            return write(200,"保存成功","data",customerService.saveCallService( callServiceJson,getUID()));
        }catch (Exception e){
@ -289,6 +301,17 @@ public class CustomerController extends BaseController {
        }
    }
    @RequestMapping(value = "/updateCallService", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "更新协同服务")
    public String updateCallService(@ApiParam(name="callServiceJson",value="协同服务json串")@RequestParam(required = true)String callServiceJson){
        try {
            return write(200,"保存成功","data",customerService.updateCallService( callServiceJson,getUID()));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
    @RequestMapping(value = "/getCallServices", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "协同服务查询")
    public String getCallServices(@ApiParam(name="keyword",value="姓名或身份证或医保卡号")@RequestParam(required = false)String keyword,
@ -305,10 +328,10 @@ public class CustomerController extends BaseController {
                                  @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));
            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,"保存失败");
            return error(-1,"查询失败");
        }
    }
@ -316,10 +339,10 @@ public class CustomerController extends BaseController {
    @ApiOperation(value = "协同服务详情")
    public String getCallServiceInfo(@ApiParam(name="code",value="协同服务编号")@RequestParam(required = true)String code){
        try {
            return write(200,"保存成功","data",customerService.getCallServiceInfo(code));
            return write(200,"查询成功","data",customerService.getCallServiceInfo(code));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
            return error(-1,"查询失败");
        }
    }

+ 9 - 6
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.entity.call;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
@ -17,7 +18,7 @@ public class CallRecord extends IdEntity {
    private Integer type; //1.呼入,2.呼出
    private String  callerNumber; //主叫号码
    private String  recipientNumber;//被叫号码
    private Integer  answerStatus;//接听状态: 1.接通,2. 队列中放弃,3.接通
    private Integer  answerStatus;//接听状态: 1.接通,2. 队列中放弃,3.未接通
    private Integer  serviceType; //服务类型:1.医生转接 2.代理咨询
    private String  serviceContent; //服务内容
    private Date createTime; //创建时间
@ -33,7 +34,7 @@ public class CallRecord extends IdEntity {
    private String  ssc; //社保卡号
    private String  doctor; //签约医生code
    private String  doctorName; //签约医生姓名
    private String  adminTeamCode;
    private Long  adminTeamCode;
    public String getCode() {
        return code;
@ -82,7 +83,7 @@ public class CallRecord extends IdEntity {
    public void setServiceContent(String serviceContent) {
        this.serviceContent = serviceContent;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
@ -90,7 +91,7 @@ public class CallRecord extends IdEntity {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getEndTime() {
        return endTime;
    }
@ -99,6 +100,7 @@ public class CallRecord extends IdEntity {
        this.endTime = endTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
@ -107,6 +109,7 @@ public class CallRecord extends IdEntity {
        this.updateTime = updateTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCallTime() {
        return callTime;
    }
@ -195,11 +198,11 @@ public class CallRecord extends IdEntity {
        this.type = type;
    }
    public String getAdminTeamCode() {
    public Long getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(String adminTeamCode) {
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
}

+ 8 - 13
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.entity.call;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
@ -15,7 +16,6 @@ public class CallService extends IdEntity {
    private String code; //服务编号
    private String callCode; //关联通话记录
    private Integer serverType; //服务类型:0.医生咨询,1.预约挂号
    private String patient; //服务对象(患者code)
    private String patientName; // 服务对象名称(患者名称)
    private String ssc; // 社保卡号
@ -28,7 +28,7 @@ public class CallService extends IdEntity {
    private Date createTime; //创建时间
    private Date updateTime; //更新时间
    private String remark; //备注
    private Integer type; //服务类型:0.咨询,2.预约
    private Integer type; //服务类型:0.咨询,1.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
@ -43,7 +43,7 @@ public class CallService extends IdEntity {
    private String orderTime; //预约时间段
    private String user; //创建人
    private String userName; //创建人
    private String adminTeamCode; //团队id
    private Long adminTeamCode; //团队id
    public String getCode() {
        return code;
@ -61,14 +61,6 @@ public class CallService extends IdEntity {
        this.callCode = callCode;
    }
    public Integer getServerType() {
        return serverType;
    }
    public void setServerType(Integer serverType) {
        this.serverType = serverType;
    }
    public String getPatient() {
        return patient;
    }
@ -141,6 +133,7 @@ public class CallService extends IdEntity {
        this.state = state;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
@ -149,6 +142,7 @@ public class CallService extends IdEntity {
        this.createTime = createTime;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getUpdateTime() {
        return updateTime;
    }
@ -181,6 +175,7 @@ public class CallService extends IdEntity {
        this.dealType = dealType;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getDealTime() {
        return dealTime;
    }
@ -285,11 +280,11 @@ public class CallService extends IdEntity {
        this.user = user;
    }
    public String getAdminTeamCode() {
    public Long getAdminTeamCode() {
        return adminTeamCode;
    }
    public void setAdminTeamCode(String adminTeamCode) {
    public void setAdminTeamCode(Long adminTeamCode) {
        this.adminTeamCode = adminTeamCode;
    }
}

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

@ -28,9 +28,11 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.*;
@Service
@Transactional
public class CustomerService extends BaseService{
	@Autowired
@ -183,21 +185,11 @@ public class CustomerService extends BaseService{
		return resp;
	}
	public Map<String,Object> addCallRecord(String user,Integer type,String callerNumber,String recipientNumber,Integer status,Integer serviceType,String serviceContent){
	public Map<String,Object> addCallRecord(String user,Integer type,String callerNumber,String recipientNumber,Integer status){
		List<Patient> list =  patientDao.findByMobile(callerNumber);
		Map<String,Object> rs = new HashedMap();
		Patient p ;
		if(list==null||list.size()==0){
			rs.put("state",-1);
			rs.put("mes","未找到患者信息");
			rs.put("callRecord",null);
			return rs;
		}else{
			p = list.get(0);
		}
		SignFamily sf = familyService.findByPatientCode(p.getCode());
		User u = userDao.findByCode(user);
		CallRecord callRecord = new CallRecord();
@ -206,18 +198,10 @@ public class CustomerService extends BaseService{
		callRecord.setCallerNumber(callerNumber);
		callRecord.setRecipientNumber(recipientNumber);
		callRecord.setAnswerStatus(status);
		callRecord.setServiceType(serviceType);
		callRecord.setServiceContent(serviceContent);
		callRecord.setCreateTime(new Date());
		callRecord.setCallTime(new Date());
		callRecord.setUserCode(user);
		callRecord.setUserName(u.getName());
		callRecord.setPatient(p.getCode());
		callRecord.setPatientName(p.getName());
		callRecord.setIdcard(p.getIdcard());
		callRecord.setSsc(p.getSsc());
		callRecord.setDoctor(sf.getDoctor());
		callRecord.setDoctorName(sf.getDoctorName());
		CallRecord temp = callRecordDao.save(callRecord);
		rs.put("state",1);
@ -227,6 +211,8 @@ public class CustomerService extends BaseService{
		return rs;
	}
	public String  updateCallRecord(String jsonString){
		net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(jsonString);
		CallRecord callRecord =(CallRecord)net.sf.json.JSONObject.toBean(json,CallRecord.class);
@ -234,16 +220,76 @@ public class CustomerService extends BaseService{
		return "1";
	}
	public String  updateCallRecordEndTime(String jsonString){
		net.sf.json.JSONObject json = net.sf.json.JSONObject.fromObject(jsonString);
		CallRecord callRecord =(CallRecord)net.sf.json.JSONObject.toBean(json,CallRecord.class);
	public Map<String,Object> updateCallRecordService(String code,String phone,Integer serviceType,String serviceContent){
		CallRecord callRecord = callRecordDao.findByCode(code);
		List<Patient> list =  patientDao.findByMobile(phone);
		Map<String,Object> rs = new HashedMap();
		Patient p ;
		if(list==null&&list.size()==0){
			rs.put("state",-1);
			rs.put("mes","未找到患者信息");
			rs.put("callRecord",null);
			return rs;
		}else{
			p = list.get(0);
		}
		SignFamily sf = familyService.findByPatientCode(p.getCode());
		if(sf==null){
			rs.put("state",-2);
			rs.put("mes","未找到患者签约信息");
			rs.put("callRecord",null);
			return rs;
		}
		//存储患者信息信息
		callRecord.setPatient(p.getCode());
		callRecord.setPatientName(p.getName());
		callRecord.setIdcard(p.getIdcard());
		callRecord.setSsc(p.getSsc());
		//存储医生信息
		callRecord.setDoctor(sf.getDoctor());
		callRecord.setDoctorName(sf.getDoctorName());
		callRecord.setServiceType(serviceType);
		callRecord.setServiceContent(serviceContent);
		callRecord.setAdminTeamCode(sf.getAdminTeamId());
		CallRecord call = callRecordDao.save(callRecord);
		rs.put("state",1);
		rs.put("mes","保存成功");
		rs.put("callRecord",call);
		return rs;
	}
	public String  updateCallRecordEndTime(String code){
		CallRecord callRecord = callRecordDao.findByCode(code);
		callRecord.setEndTime(new Date());
		callRecord.setTalkTime(DateUtil.getTimeDifference(callRecord.getCreateTime(),callRecord.getEndTime()));
		callRecordDao.save(callRecord);
		return "1";
	}
	public List<Map<String,Object>> getCallRecords(String callerNumber,Integer answerStatus,Integer serviceType ,String startDate,String endDate,Integer page,Integer size){
	public Map<String,Object> getCallRecords(String callerNumber,Integer answerStatus,Integer serviceType ,String startDate,String endDate,Integer page,Integer size){
		Map<String,Object> map = new HashedMap();
		String sqltotal = "SELECT count(1) as total" +
				" FROM " +
				" manage_call_record r " +
				" WHERE " +
				" 1 = 1 ";
		sqltotal = setCallRecordSql( sqltotal, callerNumber, answerStatus, serviceType , startDate, endDate);
		List<Map<String,Object>> rsTotal = jdbcTemplate.queryForList(sqltotal);
		Long total = (Long)rsTotal.get(0).get("total");
		if(total==0){
			map.put("callRecords",null);
			map.put("page",page);
			map.put("total",0);
			map.put("records",0);
			return map;
		}
		String sql = "SELECT " +
				" r.type, " +
@ -252,13 +298,28 @@ public class CustomerService extends BaseService{
				" r.call_time AS callTime, " +
				" r.talk_time AS talkTime, " +
				" r.answer_status AS answerStatus, " +
				" r.service_type AS serviceType, " +
				" r.type AS type, " +
				" r.user_name AS userName, " +
				" r.user_code AS userCode " +
				" r.user_code AS userCode," +
				" r.code" +
				" FROM " +
				" manage_call_record r " +
				" WHERE " +
				" 1 = 1 ";
		sql = setCallRecordSql( sql, callerNumber, answerStatus, serviceType , startDate, endDate);
		sql += " ORDER BY r.call_time DESC LIMIT "+(page-1)*size+","+size;
		List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
		map.put("page",page);
		map.put("records",total);
		map.put("callRecords",rs);
		double t = (double)total;
		map.put("total",Math.ceil(t/size));
		return map;
	}
	public String setCallRecordSql(String sql,String callerNumber,Integer answerStatus,Integer serviceType ,String startDate,String endDate){
		if(StringUtils.isNotBlank(callerNumber)){
			sql +=" AND r.caller_number = '"+callerNumber+"'";
		}
@ -274,10 +335,7 @@ public class CustomerService extends BaseService{
		if(StringUtils.isNotBlank(endDate)){
			sql +=" AND r.call_time <='"+endDate+" 23:59:59'";
		}
		sql += " LIMIT "+(page-1)*size+","+size +" ORDER BY r.call_time DESC";
		List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
		return rs;
		return sql;
	}
	public Map<String,Object> getCallRecordInfo(String code){
@ -332,7 +390,8 @@ public class CustomerService extends BaseService{
	public String saveCallService(String callServiceJson,String user){
		net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(callServiceJson);
		CallService callService =  (CallService)net.sf.json.JSONObject.toBean(jsonObject);
		CallService callService =  (CallService)net.sf.json.JSONObject.toBean(jsonObject,CallService.class);
		callService.setCode(getCallServiceCode(callService.getType()+""));
		callService.setUser(user);
		User u = userDao.findByCode(user);
		callService.setUserName(u.getName());
@ -364,7 +423,61 @@ public class CustomerService extends BaseService{
		return "1";
	}
	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){
	public String updateCallService(String callServiceJson,String user){
		net.sf.json.JSONObject jsonObject = net.sf.json.JSONObject.fromObject(callServiceJson);
		CallService callService =  (CallService)net.sf.json.JSONObject.toBean(jsonObject,CallService.class);
		callService.setUser(user);
		User u = userDao.findByCode(user);
		callService.setUserName(u.getName());
		callServiceDao.save(callService);
		//待处理发送消息给医生
		if(callService.getState()==1){
			Patient p = patientDao.findByCode(callService.getPatient());
			// 添加签约消息
			Message message = new Message();
			message.setCzrq(new Date());
			message.setCreateTime(new Date());
			message.setContent("您有一条新的协同服务消息!");
			message.setRead(1);//设置未读
			message.setReceiver(callService.getDoctor());//设置接受医生的code
			message.setSender(callService.getPatient());//设置发送的用户
			message.setSenderName(callService.getPatientName());
			message.setCode(getCode());
			message.setSenderPhoto(p.getPhoto());
			message.setTitle("协同服务消息");
			message.setType(12);//协同服务消息
			message.setReadonly(1);//是否只读消息
			message.setSex(p.getSex());
			message.setOver("1");//未处理
			messageDao.save(message);
		}
		return "1";
	}
	public 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){
		Map<String,Object> map = new HashedMap();
		String sqltotal = "SELECT count(1) AS total" +
				" FROM " +
				" manage_call_service s " +
				" WHERE " +
				" 1 = 1";
		sqltotal = setCallServiceSql( sqltotal, keyword,  serverType, state, patientName, ssc, idCard, doctorName, code, adminTeamCode , startDate, endDate);
		List<Map<String,Object>> totallist = jdbcTemplate.queryForList(sqltotal);
		Long total = (Long)totallist.get(0).get("total");
		if(total==0){
			map.put("callServices",null);
			map.put("page",page);
			map.put("total",0);
			map.put("records",0);
			return map;
		}
		String sql = "SELECT " +
				" s.`code`, " +
				" s.patient, " +
@ -381,6 +494,22 @@ public class CustomerService extends BaseService{
				" manage_call_service s " +
				" WHERE " +
				" 1 = 1";
		sql = setCallServiceSql( sql, keyword,  serverType, state, patientName, ssc, idCard, doctorName, code, adminTeamCode , startDate, endDate);
		sql += "  ORDER BY s.create_time DESC LIMIT "+(page-1)*size+","+size ;
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		map.put("page",page);
		map.put("records",total);
		map.put("callRecords",list);
		double t = (double)total;
		map.put("total",Math.ceil(t/size));
		return map;
	}
	public String setCallServiceSql(String sql,String keyword, Integer serverType,Integer state,String patientName,String ssc,String idCard,String doctorName,String code,Integer adminTeamCode ,String startDate,String endDate){
		if(StringUtils.isNotBlank(keyword)){
			sql +=" AND (s.patient_name = '"+keyword+"' OR s.ssc ='"+keyword+"' OR s.Idcard ='"+keyword+"')";
		}
@ -411,14 +540,10 @@ public class CustomerService extends BaseService{
		if(StringUtils.isNotBlank(endDate)){
			sql +=" AND s.create_time <='"+endDate+" 23:59:59'" ;
		}
		if(adminTeamCode!=null){
			sql +=" AND s.admin_team_code ="+adminTeamCode ;
		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;
		return sql;
	}
	public Map<String,Object> getCallServiceInfo(String code){

+ 27 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java

@ -37,16 +37,21 @@ public class CustomerService extends BaseService{
				" s.patient_name AS patientName, " +
				" s.doctor, " +
				" s.doctor_name AS doctorName, " +
				" s.server_type As serverType, " +
				" s.type As type, " +
				" s.state, " +
				" s.server_content AS serverContent, " +
				" s.create_time AS createTime, " +
				" s.user, " +
				" s.user_name AS userName " +
				" s.user_name AS userName ," +
				" s.create_Time AS createTime ," +
				" p.sex," +
				" p.photo," +
				" TIMESTAMPDIFF(YEAR,p.birthday,SYSDATE()) age" +
				" FROM " +
				" manage_call_service s " +
				" LEFT JOIN wlyy_patient p ON s.code = s.patient" +
				" WHERE " +
				" 1 = 1";
				" s.state >0 ";
		if(StringUtils.isNotBlank(keyword)){
			sql +=" AND (s.patient_name = '"+keyword+"' OR s.ssc ='"+keyword+"' OR s.Idcard ='"+keyword+"')";
		}
@ -57,7 +62,7 @@ public class CustomerService extends BaseService{
			sql +=" AND s.state ='"+state+"'";
		}
		if(StringUtils.isNotBlank(patientName)){
			sql +=" AND s.patient_name ='"+patientName+"'" ;
			sql +=" AND s.patient_name LIKE '%"+patientName+"%'" ;
		}
		if(StringUtils.isNotBlank(ssc)){
			sql +=" AND s.ssc ='"+ssc+"'" ;
@ -80,7 +85,7 @@ public class CustomerService extends BaseService{
		if(adminTeamCode!=null){
			sql +=" AND s.admin_team_code ="+adminTeamCode ;
		}
		sql += " LIMIT "+(page-1)*size+","+size +" ORDER BY r.create_time DESC";
		sql += " ORDER BY s.create_time DESC LIMIT "+(page-1)*size+","+size +" ";
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
@ -125,16 +130,28 @@ public class CustomerService extends BaseService{
	 * @param orderHospital
     * @return
     */
	public String dealAppointCallService(String type ,String code,String dealReason, String orderHospital,String orderHospitalName,String orderDept,String orderDeptName,String orderDoctor,String orderDoctorName,String orderTime){
		CallService callService = callServiceDao.findByCode(code);
	public String dealAppointCallService(String type ,String code,Integer dealReason,String dealContent, String orderHospital,String orderHospitalName,String orderDept,String orderDeptName,String orderDoctor,String orderDoctorName,String orderTime){
		CallService cs = callServiceDao.findByCode(code);
		//预约成功
		if("1".equals(type)){
			cs.setState(2);
			cs.setOrderDoctor(orderDoctor);
			cs.setOrderDoctorName(orderDoctorName);
			cs.setOrderDept(orderDept);
			cs.setOrderDeptName(orderDeptName);
			cs.setOrderHospital(orderHospital);
			cs.setOrderHospitalName(orderHospitalName);
			cs.setOrderTime(orderTime);
			cs.setDealTime(new Date());
			cs.setDealState(1);
		//预约失败
		}else{
			cs.setState(2);
			cs.setDealTime(new Date());
			cs.setDealReason(dealReason);
			cs.setDealContent(dealContent);
		}
		return null;
		return "1";
	}
}

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

@ -11,11 +11,12 @@ 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;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by Trick on 2017/11/14.
 */
@Controller
@RestController
@RequestMapping(value = "/doctor/pcCustomer", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "客服系统")
public class CallRecordController extends BaseController {
@ -81,4 +82,25 @@ public class CallRecordController extends BaseController {
            return error(-1,"保存失败");
        }
    }
    @RequestMapping(value = "/dealAppointCallService", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "处理预约协同服务")
    public String dealAppointCallService(@ApiParam(name="type",value="1.预约成功,2.预约失败")@RequestParam(required = true)String type ,
                                         @ApiParam(name="code",value="协同服务code(Mes中relationCode)")@RequestParam(required = false)String code,
                                         @ApiParam(name="dealReason",value="预约失败原因code")@RequestParam(required = false)Integer dealReason,
                                         @ApiParam(name="dealContent",value="预约失败内容")@RequestParam(required = false)String dealContent,
                                         @ApiParam(name="orderHospital",value="机构code")@RequestParam(required = false)String orderHospital,
                                         @ApiParam(name="orderHospitalName",value="机构")@RequestParam(required = false)String orderHospitalName,
                                         @ApiParam(name="orderDept",value="科室编码")@RequestParam(required = false)String orderDept,
                                         @ApiParam(name="orderDeptName",value="科室")@RequestParam(required = false)String orderDeptName,
                                         @ApiParam(name="orderDoctor",value="预约医生编码")@RequestParam(required = false)String orderDoctor,
                                         @ApiParam(name="orderDoctorName",value="预约医生")@RequestParam(required = false)String orderDoctorName,
                                         @ApiParam(name="orderTime",value="预约时间,按需求格式拼接字符串")@RequestParam(required = false)String orderTime){
        try {
            return write(200,"保存成功","data",customerService.dealAppointCallService( type , code, dealReason, dealContent,  orderHospital, orderHospitalName, orderDept, orderDeptName, orderDoctor, orderDoctorName, orderTime));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
}