浏览代码

Merge branch 'dev' of http://192.168.1.220:10080/Amoy/patient-co-management into dev

# Conflicts:
#	patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java
wangzhinan 6 年之前
父节点
当前提交
3e7bef1201
共有 14 个文件被更改,包括 453 次插入139 次删除
  1. 2 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java
  2. 4 5
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerQuestionnaireController.java
  3. 83 8
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java
  4. 4 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderCustomerLogDao.java
  5. 14 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderReserveConsultDao.java
  6. 5 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerLogDao.java
  7. 103 68
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java
  8. 4 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyDeviceService.java
  9. 10 5
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceService.java
  10. 212 37
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  11. 3 3
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  12. 4 4
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/patientDevice_list.jsp
  13. 2 2
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/patientDevice_list_js.jsp
  14. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

+ 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 = "获取通讯记录详情")
    @ApiOperation(value = "获取通讯记录详情")
    public String getCallRecordInfo(@ApiParam(name="code",value="通话记录code")@RequestParam(required = true)String code){
    public String getCallRecordInfo(@ApiParam(name="code",value="通话记录code")@RequestParam(required = true)String code){
        try {
        try {
            return write(200,"查询成功","data",customerService.getCallRecordInfo(code));
            return write(200,"查询成功!","data",customerService.getCallRecordInfo(code));
        }catch (Exception e){
        }catch (Exception e){
            error(e);
            error(e);
            return error(-1,"查询失败");
            return error(-1,"查询失败!");
        }
        }
    }
    }

+ 4 - 5
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerQuestionnaireController.java

@ -83,8 +83,8 @@ public class CustomerQuestionnaireController extends BaseController {
                                 @ApiParam(value = "客服code") @RequestParam String customerCode) {
                                 @ApiParam(value = "客服code") @RequestParam String customerCode) {
        try {
        try {
            //判断是否有异常中断
            //判断是否有异常中断
            Integer count = synergyManageService.findExceptionCount(workorderCode, customerCode);
            return write(200, "查询成功!", "data", count > 0 ? true : false);
            String workorderServiceCode = synergyManageService.isNotException(workorderCode, customerCode);
            return write(200, "查询成功!", "data", workorderServiceCode);
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return write(-1, "查询失败!");
            return write(-1, "查询失败!");
@ -93,10 +93,9 @@ public class CustomerQuestionnaireController extends BaseController {
    @RequestMapping(value = "loadingInfo", method = RequestMethod.GET)
    @RequestMapping(value = "loadingInfo", method = RequestMethod.GET)
    @ApiOperation(value = "载入异常工单信息")
    @ApiOperation(value = "载入异常工单信息")
    public String loadingInfo(@ApiParam(value = "协同服务工单code") @RequestParam String workorderCode,
                                 @ApiParam(value = "客服code") @RequestParam String customerCode) {
    public String loadingInfo(@ApiParam(value = "协同服务对象code") @RequestParam String workorderServiceCode) {
        try {
        try {
            return write(200, "查询成功!", "data", synergyManageService.loadingInfo(workorderCode, customerCode));
            return write(200, "查询成功!", "data", synergyManageService.loadingInfo(workorderServiceCode));
        } catch (Exception e) {
        } catch (Exception e) {
            e.printStackTrace();
            e.printStackTrace();
            return write(-1, "查询失败!");
            return write(-1, "查询失败!");

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

@ -16,8 +16,12 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.*;
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;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -50,7 +54,7 @@ public class CustomerSynergyManageController extends BaseController {
                                @RequestParam(required = true)String workorderCode,
                                @RequestParam(required = true)String workorderCode,
                                @ApiParam(name="patient",value="居民code")
                                @ApiParam(name="patient",value="居民code")
                                @RequestParam(required = false)String patient,
                                @RequestParam(required = false)String patient,
                                @ApiParam(name="role",value="1医生,2客服管理员,3普通客服")
                                @ApiParam(name="role",value="1医生,2普通客服,3客服管理员")
                                @RequestParam(required = true)Integer role){
                                @RequestParam(required = true)Integer role){
        try {
        try {
            return write(200,"请求成功","data", synergyManageService.getWorkOrderInfo(workorderCode, patient, role));
            return write(200,"请求成功","data", synergyManageService.getWorkOrderInfo(workorderCode, patient, role));
@ -246,9 +250,12 @@ public class CustomerSynergyManageController extends BaseController {
    public String saveCallLabel(@ApiParam(name="callCode",value="通话记录code")@RequestParam(value = "callCode")String callCode,
    public String saveCallLabel(@ApiParam(name="callCode",value="通话记录code")@RequestParam(value = "callCode")String callCode,
                                @ApiParam(name="callLabels",value="通话标签,多个用逗号隔开")@RequestParam(value = "callLabels",required = false)String callLabels){
                                @ApiParam(name="callLabels",value="通话标签,多个用逗号隔开")@RequestParam(value = "callLabels",required = false)String callLabels){
        try{
        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){
        }catch (Exception e){
            e.printStackTrace();
            e.printStackTrace();
            return write(-1,"保存失败!");
            return write(-1,"保存失败!");
@ -273,9 +280,12 @@ public class CustomerSynergyManageController extends BaseController {
                                @ApiParam(name="serviceType",value="服务类型,多个用逗号隔开")@RequestParam(value = "serviceType",required = false)String serviceType,
                                @ApiParam(name="serviceType",value="服务类型,多个用逗号隔开")@RequestParam(value = "serviceType",required = false)String serviceType,
                               @ApiParam(name="serviceContent",value="服务记录")@RequestParam(value = "serviceContent",required = false)String serviceContent){
                               @ApiParam(name="serviceContent",value="服务记录")@RequestParam(value = "serviceContent",required = false)String serviceContent){
        try{
        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){
        }catch (Exception e){
            e.printStackTrace();
            e.printStackTrace();
            return write(-1,"保存失败!");
            return write(-1,"保存失败!");
@ -369,5 +379,70 @@ public class CustomerSynergyManageController extends BaseController {
            return invalidUserException(e, -1, "保存随访项目数据失败!" + e.getMessage());
            return invalidUserException(e, -1, "保存随访项目数据失败!" + e.getMessage());
        }
        }
    }
    }
    @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)
                                @RequestParam(value = "userCode", required = false)String userCode,
                                @ApiParam(name = "keywords", value = "输入医生姓名、姓名、社保卡、身份证号码", required = false)
                                @RequestParam(value = "keywords", required = false)String keywords,
                                @ApiParam(name = "workorderType", value = "服务类型(0、咨询,1、健康教育,2、预约,3、随访,4、问卷调查,5、疾病筛查)", required = false)
                                @RequestParam(value = "workorderType", required = false)Integer workorderType,
                                @ApiParam(name = "isMyTask", value = "是否由我负责,1、我负责,null全部", required = false)
                                @RequestParam(value = "isMyTask", required = false)Integer isMyTask,
                                @ApiParam(name = "status", value = "工单状态(0、草稿,1、未接受,2、处理中,3、处理完成,4、退回)", required = false)
                                @RequestParam(value = "status", required = false)Integer status,
                                @ApiParam(name = "priority", value = "工单优先级(0、普通,1、加急)", required = false)
                                @RequestParam(value = "priority", required = false)Integer priority,
                                @ApiParam(name = "timeout", value = "是否超时1、超时,2、否超时,null全部", required = false)
                                @RequestParam(value = "timeout", required = false)Integer timeout,
                                @ApiParam(name = "workorderCode", value = "服务编号", required = false)
                                @RequestParam(value = "workorderCode", required = false)String workorderCode,
                                @ApiParam(name = "principal", value = "负责人", required = false)
                                @RequestParam(value = "principal", required = false)String principal,
                                @ApiParam(name = "serviceStartTime", value = "服务开始时间(格式:yyyy-MM-dd HH:mm:ss)", required = false)
                                @RequestParam(value = "serviceStartTime", required = false)String serviceStartTime,
                                @ApiParam(name = "serviceEndTime", value = "服务结束时间(格式:yyyy-MM-dd HH:mm:ss)", required = false)
                                @RequestParam(value = "serviceEndTime", required = false)String serviceEndTime,
                                @ApiParam(name = "patientName", value = "服务对象名称", required = false)
                                @RequestParam(value = "patientName", required = false)String patientName,
                                @ApiParam(name = "ssc", value = "社保卡号", required = false)
                                @RequestParam(value = "ssc", required = false)String ssc,
                                @ApiParam(name = "idcard", value = "身份证号", required = false)
                                @RequestParam(value = "idcard", required = false)String idcard,
                                @ApiParam(name = "userType", value = "2、客服,3、客服管理员", required = true)
                                @RequestParam(value = "userType", required = true)Integer userType,
                                @ApiParam(name = "isAcceptTask", value = "1、我接收到的任务,2、我派发的任务,3、待接收(客服管理员),4、已接收(客服管理员)", required = true)
                                @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,
                                HttpServletResponse response){
        try {
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            synergyManageService.exportWorkorder(userCode,keywords,workorderType,
                    isMyTask,status,priority,timeout,workorderCode,principal,serviceStartTime,serviceEndTime,
                    patientName,ssc,idcard,userType,isAcceptTask,userName,hospitalName,response);
            return write(200, "获取成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}
}

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

@ -4,6 +4,8 @@ import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderCustomerLogDO;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
/**
 * Created by 刘文彬 on 2018/9/30.
 * Created by 刘文彬 on 2018/9/30.
 */
 */
@ -14,4 +16,6 @@ public interface ManageSynergyWorkorderCustomerLogDao extends PagingAndSortingRe
    @Query("select count(1) from ManageSynergyWorkorderCustomerLogDO cl where cl.workorderCode = ?1 and cl.createUserCode = ?2 and cl.status = 0")
    @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);
    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);
}

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

@ -4,6 +4,8 @@ import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerLogDO;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
/**
 * Created by 刘文彬 on 2018/9/30.
 * Created by 刘文彬 on 2018/9/30.
 */
 */
@ -14,4 +16,7 @@ public interface ManageSynergyWorkorderServicerLogDao extends PagingAndSortingRe
    @Query("select count(distinct l.workorderServiceCode) from ManageSynergyWorkorderServicerLogDO l where l.workorderCode=?1 and l.returnVisit=2 ")
    @Query("select count(distinct l.workorderServiceCode) from ManageSynergyWorkorderServicerLogDO l where l.workorderCode=?1 and l.returnVisit=2 ")
    Integer findByWorkorderCodeAndReturnVisit(String workorderCode);
    Integer findByWorkorderCodeAndReturnVisit(String workorderCode);
    @Query("select l from ManageSynergyWorkorderServicerLogDO l where l.workorderServiceCode=?1 order by id desc")
    List<ManageSynergyWorkorderServicerLogDO> findByWorkorderServiceCode(String workorderServiceCode);
}
}

+ 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.*;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.call.CallService;
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.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.repository.call.CallRecordDao;
import com.yihu.wlyy.repository.call.CallRecordDao;
import com.yihu.wlyy.repository.call.CallServiceDao;
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.repository.synergy.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.manager.family.FamilyMemberService;
import com.yihu.wlyy.service.manager.family.FamilyMemberService;
@ -60,6 +64,8 @@ public class CustomerService extends BaseService{
	private DoctorDao doctorDao;
	private DoctorDao doctorDao;
	@Autowired
	@Autowired
	private PatientReservationDao patientReservationDao;
	private PatientReservationDao patientReservationDao;
	@Autowired
	private SignFamilyDao signFamilyDao;
	@Value(("${doctorAssistant.api}")+"/wlyygc/doctor/message")
	@Value(("${doctorAssistant.api}")+"/wlyygc/doctor/message")
	private String messageApi;
	private String messageApi;
@ -94,7 +100,23 @@ public class CustomerService extends BaseService{
				doctors.add(doctor);
				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);
		List<Map<String,Object>> labelInfo = jdbcTemplate.queryForList(labelSql);
		resp.put("signInfo",signInfo);
		resp.put("signInfo",signInfo);
		resp.put("doctors",doctors);
		resp.put("doctors",doctors);
@ -391,84 +413,97 @@ public class CustomerService extends BaseService{
	public Map<String,Object> getCallRecordInfo(String code){
	public Map<String,Object> getCallRecordInfo(String code){
		CallRecord callRecord = callRecordDao.findByCode(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 " +
				" 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 " +
				" 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();
		Map<String,Object> rs = new HashedMap();
		rs.put("callRecord",callRecord);
		rs.put("callRecord",callRecord);
		/*rs.put("consultService",consultService);
		rs.put("orderService",orderService);*/
		rs.put("patientReservation",patientReservation);
		rs.put("patientReservation",patientReservation);
		rs.put("consult",consultList);
		rs.put("follow",followList);
		rs.put("survey",surveyList);
		rs.put("screen",screenList);
		return rs;
		return rs;
	}
	}

+ 4 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyDeviceService.java

@ -192,9 +192,11 @@ public class WlyyDeviceService {
            device.setIsBinding(0);
            device.setIsBinding(0);
            //判断设备是否导入
            //判断设备是否导入
            Integer count = deviceDao.existDeviceCode(device.getDeviceCode());
            Integer count = deviceDao.existDeviceCode(device.getDeviceCode());
            if(count == 0) {
                deviceList.add(device);
            if(count != 0) {
                WlyyDevice wlyyDevice = deviceDao.findByDeviceCode(device.getDeviceCode());
                device.setId(wlyyDevice.getId());
            }
            }
            deviceList.add(device);
        }
        }
        deviceDao.save(deviceList);
        deviceDao.save(deviceList);
        return true;
        return true;

+ 10 - 5
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceService.java

@ -129,7 +129,7 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
                                                   Integer page, Integer pageSize) throws Exception{
                                                   Integer page, Integer pageSize) throws Exception{
        
        
        List<WlyyPatientDeviceVO> list = new ArrayList<>();
        List<WlyyPatientDeviceVO> list = new ArrayList<>();
        String sql  = "SELECT s.patient," +
        /*String sql  = "SELECT s.patient," +
                "d.id as id," +
                "d.id as id," +
                "d.device_id as deviceId," +
                "d.device_id as deviceId," +
                "d.user as user," +
                "d.user as user," +
@ -152,7 +152,12 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
                "wlyy_sign_family s," +
                "wlyy_sign_family s," +
                "wlyy_patient_device d," +
                "wlyy_patient_device d," +
                "wlyy_patient p " +
                "wlyy_patient p " +
                "WHERE s.patient=d.`user` ";
                "WHERE s.patient=d.`user` ";*/
        String sql = "SELECT d.id as id,d.device_id as deviceId,d.user as user,p.name as userName,d.category_code as categoryCode,d.device_name as deviceName," +
                "d.device_sn as deviceSn,d.sim as sim,d.user_type as userType,p.mobile," +
                "CONCAT(LEFT (p.idcard,6),'**********',RIGHT (p.idcard,2)) userIdcard,d.czrq as czrq " +
                "FROM wlyy_patient_device d,wlyy_patient p " +
                "WHERE d.`user`=p.CODE ";
        if(StringUtils.isNotBlank(hospitalName)){
        if(StringUtils.isNotBlank(hospitalName)){
            sql = sql + "AND s.hospital_name like '%"+hospitalName+"%' ";
            sql = sql + "AND s.hospital_name like '%"+hospitalName+"%' ";
        }
        }
@ -181,10 +186,10 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
            sql = sql + "AND d.device_name like '%"+deviceName+"%' ";
            sql = sql + "AND d.device_name like '%"+deviceName+"%' ";
        }
        }
        
        
        sql = sql +"AND s.`status`> 0 AND s.patient=p.CODE " +
                "ORDER BY czrq DESC ";
       /* sql = sql +"AND s.`status`> 0 AND s.patient=p.CODE " +
                "ORDER BY czrq DESC ";*/
        
        
        sql = sql+" limit " + (page-1)*pageSize+", "+pageSize;
        sql = sql+"ORDER BY czrq DESC limit " + (page-1)*pageSize+", "+pageSize;
        System.out.println("list:"+sql);
        System.out.println("list:"+sql);
        list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WlyyPatientDeviceVO.class));
        list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WlyyPatientDeviceVO.class));
        return list ;
        return list ;

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

@ -1,10 +1,12 @@
package com.yihu.wlyy.service.synergy;
package com.yihu.wlyy.service.synergy;
import com.yihu.wlyy.entity.*;
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.ManageSynergyWorkordeReminderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderExecutorDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderExecutorDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.entity.synergy.*;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.repository.synergy.*;
import com.yihu.wlyy.repository.synergy.*;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
@ -13,10 +15,12 @@ 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.Workbook;
import jxl.write.*;
import jxl.write.*;
import org.apache.commons.collections.map.HashedMap;
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;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
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;
@ -128,8 +132,8 @@ public class SynergyManageService extends BaseJpaService {
        }
        }
        //关键字查询
        //关键字查询
        servicerTable +=" left join wlyy.manage_synergy_workorder_servicer s on s.workorder_code=w.code ";
        if(StringUtils.isNotEmpty(keywords)){
        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.servicer_count<=10  ";
            whereSql += " and (w.create_user_name like '%"+keywords+"%' or s.service_patient_name like '%"+keywords+"%' " +
            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+"%' ) ";
                    " or s.ssc like '%"+keywords+"%' or s.idcard like '%"+keywords+"%' ) ";
@ -306,17 +310,19 @@ public class SynergyManageService extends BaseJpaService {
     */
     */
    public Map<String, Object> getWorkOrderInfo(String workorderCode, String patient, Integer role) {
    public Map<String, Object> getWorkOrderInfo(String workorderCode, String patient, Integer role) {
        Map<String, Object> map = new HashMap<>();
        Map<String, Object> map = new HashMap<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        ManageSynergyWorkorderDO workorderDO = workOrderDao.findByCode(workorderCode);
        ManageSynergyWorkorderDO workorderDO = workOrderDao.findByCode(workorderCode);
        Integer status = workorderDO.getStatus();
        Integer status = workorderDO.getStatus();
        //存入协同服务工单信息
        //存入协同服务工单信息
        map.put("code", workorderCode);
        map.put("code", workorderCode);
        map.put("type", workorderDO.getType());
        map.put("type", workorderDO.getType());
        map.put("priority", workorderDO.getPriority());
        map.put("priority", workorderDO.getPriority());
        map.put("serviceTime", workorderDO.getServiceTime());
        map.put("serviceTime", s.format(workorderDO.getServiceTime()));
        map.put("status", status);
        map.put("status", status);
        map.put("title", workorderDO.getRelationCodeName());
        map.put("title", workorderDO.getRelationCodeName());
        map.put("remark", workorderDO.getRemark());
        map.put("remark", workorderDO.getRemark());
        map.put("createTime", workorderDO.getCreateTime());
        map.put("createTime", sdf.format(workorderDO.getCreateTime()));
        map.put("createUserName", workorderDO.getCreateUserName());
        map.put("createUserName", workorderDO.getCreateUserName());
        map.put("hospitalName", workorderDO.getHospitalName());
        map.put("hospitalName", workorderDO.getHospitalName());
@ -324,10 +330,10 @@ public class SynergyManageService extends BaseJpaService {
        if(StringUtils.isNotBlank(patient)){
        if(StringUtils.isNotBlank(patient)){
            //获取单个居民处理完成的工单信息
            //获取单个居民处理完成的工单信息
            ManageSynergyWorkorderServicerDO workorderServicerDO = workorderServicerDao.findByWorkOrderCodeAndPatientCode(workorderCode, patient);
            ManageSynergyWorkorderServicerDO workorderServicerDO = workorderServicerDao.findByWorkOrderCodeAndPatientCode(workorderCode, patient);
            map.put("servicerKey", workorderServicerDO.getServicePatientName());
            map.put("patientName", workorderServicerDO.getServicePatientName());
            map.put("idcard", workorderServicerDO.getIdcard());
            map.put("idcard", workorderServicerDO.getIdcard());
            map.put("ssc", workorderServicerDO.getSsc());
            map.put("ssc", workorderServicerDO.getSsc());
            map.put("completeTime", workorderServicerDO.getCompleteTime());
            map.put("completeTime", sdf.format(workorderServicerDO.getCompleteTime()));
        }else {
        }else {
            if(status == 2 || status == 3){
            if(status == 2 || status == 3){
                //获取工单完成人数
                //获取工单完成人数
@ -341,7 +347,7 @@ public class SynergyManageService extends BaseJpaService {
        //超时标签
        //超时标签
        map.put("delayStatus", this.isServiceOverTime(workorderDO.getServiceTime()));
        map.put("delayStatus", this.isServiceOverTime(workorderDO.getServiceTime()));
        //根据角色显示对应工单状态
        //根据角色显示对应工单状态
        if(workorderDO.getCreateUserType() == 1 && role == 2){
        if(workorderDO.getCreateUserType() == 1 && role == 3){
            map.put("status", "待接收");
            map.put("status", "待接收");
        }else if(workorderDO.getCreateUserType() == 2 && role == 1){
        }else if(workorderDO.getCreateUserType() == 2 && role == 1){
            map.put("status", "未接收");
            map.put("status", "未接收");
@ -350,7 +356,7 @@ public class SynergyManageService extends BaseJpaService {
        if(status == 2){
        if(status == 2){
            //接收者
            //接收者
            map.put("receiverName", workorderDO.getReceiverName());
            map.put("receiverName", workorderDO.getReceiverName());
            map.put("receiverTime", workorderDO.getReceiverTime());
            map.put("receiverTime", sdf.format(workorderDO.getReceiverTime()));
            //获取负责人信息
            //获取负责人信息
            List<ManageSynergyWorkorderExecutorDO> managerList = workorderExecutorDao.findByWorkorderCode(workorderCode,1);
            List<ManageSynergyWorkorderExecutorDO> managerList = workorderExecutorDao.findByWorkorderCode(workorderCode,1);
            List<ManageSynergyWorkorderExecutorDO> collaboratorList = workorderExecutorDao.findByWorkorderCode(workorderCode,2);
            List<ManageSynergyWorkorderExecutorDO> collaboratorList = workorderExecutorDao.findByWorkorderCode(workorderCode,2);
@ -390,6 +396,7 @@ public class SynergyManageService extends BaseJpaService {
                                               String diseaseCode,String healthCode,String serveCode,Integer isFollow) throws Exception{
                                               String diseaseCode,String healthCode,String serveCode,Integer isFollow) throws Exception{
        String whereSql ="";
        String whereSql ="";
        String leftSql ="";
        String leftSql ="";
        String orderBySql =" l.id desc";
        if(StringUtils.isNotEmpty(townCode)){
        if(StringUtils.isNotEmpty(townCode)){
            whereSql+=" and s.town='"+townCode+"' ";
            whereSql+=" and s.town='"+townCode+"' ";
        }
        }
@ -413,18 +420,22 @@ public class SynergyManageService extends BaseJpaService {
            whereSql+= " and ( "+labelSql.substring(3)+" )";
            whereSql+= " and ( "+labelSql.substring(3)+" )";
        }
        }
        if(isFollow!=null&&isFollow==1){//跟进
        if(isFollow!=null&&isFollow==1){//跟进
            leftSql+=" LEFT JOIN manage_synergy_workorder_servicer_log ll on ll.workorder_service_code=s.code ";
            whereSql+=" and ll.follow_up=2 ";
            leftSql+=" LEFT JOIN manage_synergy_workorder_servicer_log ll on ll.service_patient_code=s.code ";
            whereSql+=" and ll.follow_up=2 and ll.workorder_service_code not in (select DISTINCT lll.workorder_service_code from manage_synergy_workorder_servicer_log lll where lll.follow_up=1 and lll.workorder_code='"+workorderCode+"') ";
            orderBySql=" ll.id desc";
            whereSql+=" and s.status=3 ";
        }else{
            whereSql+=" and s.status=1 ";
        }
        }
        String sql =" select DISTINCT w.*,s.mobile,s.service_patient_name,s.service_patient_code,s.code as servicerCode,s.town_name,s.hospital_name " +
        String sql =" select DISTINCT w.*,s.mobile,s.service_patient_name,s.service_patient_code,s.code as servicerCode,s.town_name,s.hospital_name, " +
                " w.create_user_name " +
                " w.create_user_name " +
                " from manage_synergy_workorder_servicer s " +
                " from manage_synergy_workorder_servicer s " +
                " LEFT JOIN manage_synergy_workorder w on s.workorder_code=w.code " +
                " LEFT JOIN manage_synergy_workorder w on s.workorder_code=w.code " +
                " LEFT JOIN manage_synergy_workorder_executor e on e.workorder_code=w.code " + leftSql+
                " LEFT JOIN manage_synergy_workorder_executor e on e.workorder_code=w.code " + leftSql+
                " LEFT JOIN manage_synergy_workorder_customer_log l on l.workorder_service_code = s.code " +
                " where s.status=1  and s.workorderCode='"+workorderCode+"' " +
                " LEFT JOIN manage_synergy_workorder_customer_log l on l.workorder_service_code=s.service_patient_code " +
                " where s.workorder_code='"+workorderCode+"' " +
                " and w.del=1 and w.status=2 and e.del=1 "+
                " and w.del=1 and w.status=2 and e.del=1 "+
                whereSql+" order by l.id desc";
                whereSql+" order by "+orderBySql;
        List<Map<String,Object>> resultWorkorderList = jdbcTemplate.queryForList(sql);
        List<Map<String,Object>> resultWorkorderList = jdbcTemplate.queryForList(sql);
        Map<String,Object> resultMap = new HashMap<>();
        Map<String,Object> resultMap = new HashMap<>();
        if(resultWorkorderList.size()>0){
        if(resultWorkorderList.size()>0){
@ -435,7 +446,7 @@ public class SynergyManageService extends BaseJpaService {
            Integer callNum = customerLogDao.callNumByWorkorder(workorderMap.get("servicerCode")+"");
            Integer callNum = customerLogDao.callNumByWorkorder(workorderMap.get("servicerCode")+"");
            resultMap.put("callNum",callNum);//已呼叫次数
            resultMap.put("callNum",callNum);//已呼叫次数
            resultMap.putAll(this.getPatientInfo(workorderMap.get("service_patient_code") + ""));
            resultMap.putAll(this.getPatientInfo(workorderMap.get("service_patient_code") + ""));
            /*Patient patient =patientDao.findByCode(workorderMap.get("service_patient_code")+"");
            Patient patient =patientDao.findByCode(workorderMap.get("service_patient_code")+"");
            Integer sex = patient.getSex();
            Integer sex = patient.getSex();
            String sexName ="";
            String sexName ="";
            if(sex==1){
            if(sex==1){
@ -470,7 +481,23 @@ public class SynergyManageService extends BaseJpaService {
            for(SignPatientLabelInfo one:labelServeType){
            for(SignPatientLabelInfo one:labelServeType){
                serveType+=","+one.getLabelName();
                serveType+=","+one.getLabelName();
            }
            }
            resultMap.put("serveType",StringUtils.isNotEmpty(serveType)?serveType.substring(1):"");//服务类型*/
            resultMap.put("serveType",StringUtils.isNotEmpty(serveType)?serveType.substring(1):"");//服务类型
            //获取提交记录
            String servicerCode = workorderMap.get("servicerCode")+"";
            List<ManageSynergyWorkorderServicerLogDO> list = manageSynergyWorkorderServicerLogDao.findByWorkorderServiceCode(servicerCode);
            if(list.size()>0){
                ManageSynergyWorkorderServicerLogDO log = list.get(0);
                Map<String,Object> m = new HashMap<>();
                m.put("personal",log.getPersonal());
                m.put("callCode",log.getCallCode());
                m.put("callStatus",log.getCallStatus());
                m.put("emphasis",log.getEmphasis());
                m.put("followUp",log.getFollowUp());
                m.put("remark",log.getRemark());
                m.put("returnVisit",log.getReturnVisit());
                resultMap.put("servicerLog",m);
            }
            return resultMap;
            return resultMap;
        }else{
        }else{
            throw new Exception("没有任务");
            throw new Exception("没有任务");
@ -582,24 +609,33 @@ public class SynergyManageService extends BaseJpaService {
     * @param customerCode
     * @param customerCode
     * @return
     * @return
     */
     */
    public Integer findExceptionCount(String workorderCode, String customerCode) {
        return customerLogDao.findExceptionCount(workorderCode, customerCode);
    public String isNotException(String workorderCode, String customerCode) {
        String sql = "SELECT cl.workorder_service_code  from manage_synergy_workorder_customer_log cl " +
                "where cl.workorder_service_code not in (SELECT l.workorder_service_code from manage_synergy_workorder_customer_log l where l.`status` = 2) " +
                "and cl.workorder_code = '" + workorderCode + "' and cl.create_user_code= '" + customerCode + "' " +
                "GROUP BY cl.workorder_code, cl.create_user_code " +
                "ORDER BY cl.create_time LIMIT 0, 1";
        String  workorderServiceCode = jdbcTemplate.queryForObject(sql, String.class);
        return workorderServiceCode;
    }
    }
    public Map<String, Object> loadingInfo(String workorderCode, String customerCode) {
    public Map<String, Object> loadingInfo(String workorderServiceCode) {
        Map<String,Object> resultMap = new HashMap<>();
        Map<String,Object> resultMap = new HashMap<>();
        String sql = "SELECT s.service_patient_name, s.service_patient_code, s.`code`, s.s.hospital_name,s.town_name " +
        ManageSynergyWorkorderServicerDO workorderServicerDO = workorderServicerDao.findByCode(workorderServiceCode);
        /*String sql = "SELECT s.service_patient_name, s.service_patient_code, s.`code`, s.s.hospital_name,s.town_name " +
                "from (SELECT DISTINCT r.patient,cl.workorder_code from manage_synergy_workorder_customer_log cl " +
                "from (SELECT DISTINCT r.patient,cl.workorder_code from manage_synergy_workorder_customer_log cl " +
                "LEFT JOIN manage_call_record r on cl.call_code = r.`code` " +
                "LEFT JOIN manage_call_record r on cl.call_code = r.`code` " +
                "where cl.workorder_code = " + workorderCode + " and cl.create_user_code = " + customerCode + " and cl.`status` = 0 ORDER BY cl.create_time LIMIT 0,1) p " +
                "where cl.workorder_code = '" + workorderCode + "' and cl.create_user_code = '" + customerCode + "' and cl.`status` = 0 ORDER BY cl.create_time LIMIT 0,1) p " +
                "LEFT JOIN manage_synergy_workorder_servicer s on p.workorder_code = s.workorder_code and s.service_patient_code = p.patient and s.`status`=1";
                "LEFT JOIN manage_synergy_workorder_servicer s on p.workorder_code = s.workorder_code and s.service_patient_code = p.patient and s.`status`=1";
        Map<String, Object> result = (Map<String, Object>) jdbcTemplate.queryForList(sql);
        Map<String, Object> result = (Map<String, Object>) jdbcTemplate.queryForList(sql);
        String patientCode = (String) result.get("service_patient_name");
        String patientCode = (String) result.get("service_patient_name");
        */
        String patientCode = workorderServicerDO.getServicePatientName();
        resultMap.put("patientName", patientCode);
        resultMap.put("patientName", patientCode);
        resultMap.put("townName", result.get("town_name"));//所属区县
        resultMap.put("hospitalName", result.get("hospital_name"));//所属社区
        Integer callNum = customerLogDao.callNumByWorkorder((String) result.get("code"));
        resultMap.put("townName", workorderServicerDO.getTownName());//所属区县
        resultMap.put("hospitalName", workorderServicerDO.getHospitalName());//所属社区
        Integer callNum = customerLogDao.callNumByWorkorder(workorderServiceCode);
        resultMap.put("callNum",callNum);//已呼叫次数
        resultMap.put("callNum",callNum);//已呼叫次数
        resultMap.putAll(this.getPatientInfo(patientCode));
        resultMap.putAll(this.getPatientInfo(patientCode));
        return resultMap;
        return resultMap;
@ -904,10 +940,32 @@ public class SynergyManageService extends BaseJpaService {
        return  jsonObject;
        return  jsonObject;
    }
    }
    /**
     * 到处Excel表
     * @param code
     * @param keywords
     * @param workorderType
     * @param isMyTask
     * @param status
     * @param priority
     * @param timeout
     * @param workorderCode
     * @param principal
     * @param serviceStartTime
     * @param serviceEndTime
     * @param patientName
     * @param ssc
     * @param idcard
     * @param userType
     * @param isAcceptTask
     * @param response
     * @throws Exception
     */
    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,HttpServletResponse response) throws Exception{
                                String patientName,String ssc,String idcard,Integer userType,Integer isAcceptTask,String userName,String hospitalName,
                                HttpServletResponse response) throws Exception{
        WritableWorkbook wwb = null;
        WritableWorkbook wwb = null;
        try{
        try{
@ -993,6 +1051,14 @@ public class SynergyManageService extends BaseJpaService {
            if(StringUtils.isNotEmpty(idcard)){
            if(StringUtils.isNotEmpty(idcard)){
                whereSql+=" s.idcard like '%"+keywords+"%' ";
                whereSql+=" 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+
                    " where w.del=1  " +
                    " where w.del=1  " +
@ -1005,26 +1071,62 @@ public class SynergyManageService extends BaseJpaService {
            OutputStream os = response.getOutputStream();
            OutputStream os = response.getOutputStream();
            wwb = Workbook.createWorkbook(os);
            wwb = Workbook.createWorkbook(os);
            WritableSheet ws = Workbook.createWorkbook(os).createSheet("sheet",1);
            WritableSheet ws = Workbook.createWorkbook(os).createSheet("sheet",1);
            String[] header = {"SN码","创建日期","身份证号","姓名","数据类型","value1","value2","value3","value4","value5","value6","value7"};
            List<String> header = null;
            if(isAcceptTask==1){//我接收的任务
                header = new ArrayList<>(Arrays.asList("服务编号","服务类型","创建时间","服务对象","工单状态","需求方","负责人","服务内容"));
            }else if(isAcceptTask==2){//我派发的任务
                header = new ArrayList<>(Arrays.asList("服务编号","服务类型","创建时间","服务对象","工单状态","家庭医生","所属机构","服务内容"));
            }
            int i = 0;
            int i = 0;
            for (String h : header) {
            for (String h : header) {
                Label label = new Label(0, i, h);
                Label label = new Label(0, i, h);
                ws.addCell(label);
                ws.addCell(label);
                i++;
                i++;
            }
            }
            Integer workorderTypeR = null;
            String workorderTypeName = null;
            Date createTime = null;
            for(Map<String,Object> one:list){
            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(),"");
                workorderTypeR = (Integer) one.get("workorder_type");
                createTime = (Date)one.get("create_time");
                addCell(ws, i, 0, one.get("code")+"","");
                switch (workorderTypeR){
                    case 0: workorderTypeName="咨询";break;
                    case 1: workorderTypeName="健康教育";break;
                    case 2: workorderTypeName="预约";break;
                    case 3: workorderTypeName="随访";break;
                    case 4: workorderTypeName="问卷调查";break;
                    case 5: workorderTypeName="疾病筛查";break;
                }
                addCell(ws, i, 1, workorderTypeName,"");
                addCell(ws, i, 2, DateUtil.dateToStr(createTime,"yyyy--MM-dd HH:mm:ss"),"");
                if(isAcceptTask==1){//我接收的任务
                    String[] servicer = (one.get("servicer_key")+"").split(",");
                    Integer servicerCount = (Integer) one.get("servicer_count");
                    addCell(ws, i, 1, servicer[0]+"等"+servicerCount+"人","");
                }else if(isAcceptTask==2){//我派发的任务
                    String[] servicer = (one.get("servicer_key")+"").split(",");
                    addCell(ws, i, 1, servicer[0],"");
                }
                Integer statusR = (Integer) one.get("status");
                String statusName="";
                switch (statusR){
                    case 0:statusName="草稿";break;
                    case 1:statusName="未接受";break;
                    case 2:statusName="处理中";break;
                    case 3:statusName="处理完成";break;
                    case 4:statusName="退回";break;
                }
                addCell(ws, i, 3, statusName,"");
                addCell(ws, i, 4, one.get("create_user_name")+"","");
                if(isAcceptTask==1){//我接收的任务
                    List<ManageSynergyWorkorderExecutorDO> managerList = workorderExecutorDao.findByWorkorderCode(one.get("code")+"",1);
                    String managerName = managerList.size()>0?managerList.get(0).getExecutorName():"";
                    addCell(ws, i, 5, managerName,"");//负责人
                }else if(isAcceptTask==2) {//我派发的任务
                    addCell(ws, i, 5, one.get("hospital_name")+"","");//所属机构
                }
                addCell(ws, i, 5, one.get("content")+"","");
                i++;
                i++;
            }
            }
            wwb.write();
            wwb.write();
@ -1079,4 +1181,77 @@ public class SynergyManageService extends BaseJpaService {
        }
        }
        return list;
        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
     * @param workorderServiceCode
     * @param userCode
     * @param userName
     * @param callCode
     * @param status
     */
    public void addWorkorderCustomerLog(String workorderCode,String workorderServiceCode,String userCode,String userName,String callCode,String status){
    }
}
}

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

@ -60,9 +60,9 @@ spring:
  profiles: dev
  profiles: dev
  datasource:
  datasource:
    wlyy:
    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:
    device:
      url: jdbc:mysql://172.19.103.77/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://172.19.103.77/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: root
      username: root

+ 4 - 4
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/patientDevice_list.jsp

@ -17,9 +17,9 @@
	<!-- 检索条件 -->
	<!-- 检索条件 -->
	<div class="m-retrieve-area f-h50 f-dn f-pr m-form-inline" data-role-form style='display: block;'>
	<div class="m-retrieve-area f-h50 f-dn f-pr m-form-inline" data-role-form style='display: block;'>
		<div class="m-form-group f-mt10">
		<div class="m-form-group f-mt10">
			<div class="m-form-control f-ml15">
			<%--<div class="m-form-control f-ml15">
				<input type="text" id="inp_hospital_name" placeholder="请输入机构名称" class="f-ml10" data-attr-scan="hospitalName"/>
				<input type="text" id="inp_hospital_name" placeholder="请输入机构名称" class="f-ml10" data-attr-scan="hospitalName"/>
			</div>
			</div>--%>
			<div class="m-form-control f-ml15">
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_device_name" placeholder="请输入设备名称" class="f-ml10" data-attr-scan="deviceName"/>
				<input type="text" id="inp_device_name" placeholder="请输入设备名称" class="f-ml10" data-attr-scan="deviceName"/>
			</div>
			</div>
@ -32,9 +32,9 @@
			<div class="m-form-control f-ml15">
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_user_name" placeholder="请输入居民姓名" class="f-ml10" data-attr-scan="userName"/>
				<input type="text" id="inp_user_name" placeholder="请输入居民姓名" class="f-ml10" data-attr-scan="userName"/>
			</div>
			</div>
			<div class="m-form-control f-ml15">
			<%--<div class="m-form-control f-ml15">
				<input type="text" id="inp_doctor_name" placeholder="请输入医生/健管师姓名" class="f-ml10" data-attr-scan="doctorName"/>
				<input type="text" id="inp_doctor_name" placeholder="请输入医生/健管师姓名" class="f-ml10" data-attr-scan="doctorName"/>
			</div>
			</div>--%>
			<sec:authorize url="/admin/patientDevice/list">
			<sec:authorize url="/admin/patientDevice/list">
				<div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
				<div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
					<span>查询</span>
					<span>查询</span>

+ 2 - 2
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/patientDevice_list_js.jsp

@ -92,9 +92,9 @@
							},
							},
							{display: 'SN码', name: 'deviceSn', width: '10%', align: "left"},
							{display: 'SN码', name: 'deviceSn', width: '10%', align: "left"},
							{display: 'SIM码', name: 'sim', width: '5%', align: "left"},
							{display: 'SIM码', name: 'sim', width: '5%', align: "left"},
                            {display: '社区', name: 'hospitalName', width: '10%', align: "left"},
                           /* {display: '社区', name: 'hospitalName', width: '10%', align: "left"},
                            {display: '医生', name: 'doctorName', width: '5%', align: "left"},
                            {display: '医生', name: 'doctorName', width: '5%', align: "left"},
                            {display: '健管师', name: 'doctorHealthName', width: '5%', align: "left"},
                            {display: '健管师', name: 'doctorHealthName', width: '5%', align: "left"},*/
							{display: '居民姓名', name: 'userName', width: '5%', align: "center"},
							{display: '居民姓名', name: 'userName', width: '5%', align: "center"},
							{
							{
								display: '绑定按键', name: 'userType', width: '5%', align: "center",
								display: '绑定按键', name: 'userType', width: '5%', align: "center",

+ 3 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java

@ -1944,14 +1944,14 @@ public class ManagerQuestionnaireService extends BaseService {
     */
     */
    public String saveQuestionResultAndAnswer(JSONObject jsonData, String patientCode, String customerCode) throws Exception {
    public String saveQuestionResultAndAnswer(JSONObject jsonData, String patientCode, String customerCode) throws Exception {
        String surveyCode = jsonData.get("surveyCode").toString();
        String surveyCode = jsonData.get("surveyCode").toString();
        SurveyTemplates templates = surveyTemplatesDao.findById(surveyCode);
        Survey survey = surveyDao.findById(surveyCode);
        Patient patient = patientDao.findByCode(patientCode);
        Patient patient = patientDao.findByCode(patientCode);
        User user = userDao.findByCode(customerCode);
        User user = userDao.findByCode(customerCode);
        SurveyQuestionResult questionResult =  new SurveyQuestionResult();
        SurveyQuestionResult questionResult =  new SurveyQuestionResult();
        String code = getCode();
        String code = getCode();
        questionResult.setCode(code);
        questionResult.setCode(code);
        questionResult.setTemplateCode(templates.getCode());
        questionResult.setTemplateTitle(templates.getTitle());
        questionResult.setTemplateCode(survey.getCode());
        questionResult.setTemplateTitle(survey.getTitle());
        questionResult.setPatientCode(patient.getCode());
        questionResult.setPatientCode(patient.getCode());
        questionResult.setPatientName(patient.getName());
        questionResult.setPatientName(patient.getName());
        questionResult.setType(1);
        questionResult.setType(1);