Browse Source

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

# Conflicts:
#	patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/synergy/SynergyManagerController.java
humingfen 6 years ago
parent
commit
d1c11fbd16
24 changed files with 897 additions and 135 deletions
  1. 9 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/imm/ChildImmuneVaccin.java
  2. 14 1
      patient-co-manage/wlyy-manage/pom.xml
  3. 2 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java
  4. 125 11
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java
  5. 23 3
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/doctor/DoctorSynergyManageController.java
  6. 10 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageCustomerOnlineRecordDO.java
  7. 2 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderDO.java
  8. 2 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/UserDao.java
  9. 6 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageCustomerOnlineRecordDao.java
  10. 5 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderCustomerLogDao.java
  11. 14 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderReserveConsultDao.java
  12. 4 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerDao.java
  13. 103 68
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java
  14. 222 20
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  15. 61 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyWorkorderServicerLogService.java
  16. 10 4
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  17. 1 1
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java
  18. 1 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/imm/ChildVaccinImmuneService.java
  19. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistHospitalItemService.java
  20. 43 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/ManageSynergyService.java
  21. 182 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  22. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java
  23. 38 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/synergy/SynergyManageController.java
  24. 18 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/synergy/SynergyManagerController.java

+ 9 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/imm/ChildImmuneVaccin.java

@ -27,6 +27,7 @@ public class ChildImmuneVaccin extends IdEntity {
	private String ymbm;                    //疫苗编码
	private String jzzc;                    //接种针次
	private Date jzrq;						  //接种日期
	private int ymsx;						  //疫苗属性(1:一类,2:二类)
	private Integer isOut;					  //是否超过接种日期7天(0是 1不是)
	private Integer alert_tag;              //0待提醒,1已提醒
	private Date alert_time;                //提醒时间
@ -131,6 +132,14 @@ public class ChildImmuneVaccin extends IdEntity {
		this.jzrq = jzrq;
	}
	public int getYmsx() {
		return ymsx;
	}
	public void setYmsx(int ymsx) {
		this.ymsx = ymsx;
	}
	public Integer getIsOut() {
		return isOut;
	}

+ 14 - 1
patient-co-manage/wlyy-manage/pom.xml

@ -291,7 +291,20 @@
                    <groupId>com.yihu</groupId>
                    <artifactId>jave-ffmpegjave</artifactId>
                </dependency>-->
        <dependency>
            <groupId>com.aspose.words</groupId>
            <artifactId>aspose-words-jdk16</artifactId>
            <version>14.6.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>jave-ffmpegjave</artifactId>
            <version>1.0.4</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>wlyy-manage</finalName>

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

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

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

@ -1,11 +1,14 @@
package com.yihu.wlyy.controller.synergy.customer;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerLogDO;
import com.yihu.wlyy.repository.call.CallRecordDao;
import com.yihu.wlyy.service.manager.user.UserService;
import com.yihu.wlyy.service.synergy.SynergyManageService;
import com.yihu.wlyy.service.synergy.SynergyWorkorderServicerLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -13,10 +16,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
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 org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
@ -34,11 +34,15 @@ public class CustomerSynergyManageController extends BaseController {
    @Autowired
    private SynergyManageService synergyManageService;
    @Autowired
    private SynergyWorkorderServicerLogService synergyWorkorderServicerLogService;
    @Autowired
    private UserService userService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private CallRecordDao callRecordDao;
    @Autowired
    private ObjectMapper objectMapper;
    @RequestMapping(value = "/getWorkOrderInfo", method = {RequestMethod.GET, RequestMethod.POST})
@ -243,9 +247,12 @@ public class CustomerSynergyManageController extends BaseController {
    public String saveCallLabel(@ApiParam(name="callCode",value="通话记录code")@RequestParam(value = "callCode")String callCode,
                                @ApiParam(name="callLabels",value="通话标签,多个用逗号隔开")@RequestParam(value = "callLabels",required = false)String callLabels){
        try{
            String sql ="UPDATE manage_call_record SET call_label='"+callLabels+"' WHERE `code`='"+callCode+"'";
            jdbcTemplate.update(sql);
            return write(200,"保存成功!");
            int result = synergyManageService.saveCallLabel(callLabels,callCode);
            if (result>0){
                return write(200,"保存成功!");
            }else {
                return write(-1,"保存失败!");
            }
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败!");
@ -254,7 +261,7 @@ public class CustomerSynergyManageController extends BaseController {
    @RequestMapping(value = "getCallInfo",method = RequestMethod.GET)
    @ApiOperation(value = "获取通话的详情")
    public String getCallTypeAndContent(@ApiParam(name="callCode",value="通话记录code")@RequestParam(required = false)String callCode){
    public String getCallTypeAndContent(@ApiParam(name="callCode",value="通话记录code")@RequestParam(value ="callCode")String callCode){
        try{
            CallRecord callRecord = callRecordDao.findByCode(callCode);
            return write(200,"查询成功!","data",callCode);
@ -270,9 +277,12 @@ public class CustomerSynergyManageController extends BaseController {
                                @ApiParam(name="serviceType",value="服务类型,多个用逗号隔开")@RequestParam(value = "serviceType",required = false)String serviceType,
                               @ApiParam(name="serviceContent",value="服务记录")@RequestParam(value = "serviceContent",required = false)String serviceContent){
        try{
            String sql ="UPDATE manage_call_record SET service_type='"+serviceType+"',service_content='"+serviceContent+"' WHERE `code`='"+callCode+"'";
            jdbcTemplate.update(sql);
            return write(200,"保存成功!");
            int result = synergyManageService.saveCallInfo(serviceType,serviceContent,callCode);
            if (result>0){
                return write(200,"保存成功!");
            }else {
                return write(-1,"保存失败!");
            }
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败!");
@ -297,6 +307,21 @@ public class CustomerSynergyManageController extends BaseController {
        }
    }
    @RequestMapping(value = "/createServicerLog",method = RequestMethod.POST)
    @ApiOperation(value = "添加协同服务日志")
    public String dealWorkOrder(@ApiParam(name="servicerLogDO",value="协同服务日志")
                                @RequestParam(name = "servicerLogDO",required = true)String servicerLogDO){
        try {
            ManageSynergyWorkorderServicerLogDO synergyWorkorderServicerLogDO = objectMapper.readValue(servicerLogDO,ManageSynergyWorkorderServicerLogDO.class);
            synergyWorkorderServicerLogService.create(synergyWorkorderServicerLogDO);
            return write(200,"保存成功");
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
    @RequestMapping(value = "getDealList",method = RequestMethod.GET)
    @ApiOperation(value = "通话详情获取待办事项")
    public String getDealList(@ApiParam(name="idcard",value="居民身份证")@RequestParam(value ="idcard")String idcard){
@ -309,6 +334,60 @@ public class CustomerSynergyManageController extends BaseController {
        }
    }
    @ApiOperation("新增临时随访记录(返回ID)")
    @RequestMapping(value = "/addFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    public String addFollowup(@ApiParam(name = "doctor", value = "医生code")
                              @RequestParam(value = "doctor", required = true) String doctor,
                              @ApiParam(name = "patient", value = "患者代码", defaultValue = "443a196ef8744536a531260eb26c05d7")
                              @RequestParam(value = "patient", required = true) String patient,
                              @ApiParam(name = "date", value = "下次随访时间", defaultValue = "2016-12-15 20:00:00")
                              @RequestParam(value = "date", required = true) String date,
                              @ApiParam(name = "followupType", value = "随访方式【字典FOLLOWUP_WAY_DICT】", defaultValue = "12")
                              @RequestParam(value = "followupType", required = true) String followupType,
                              @ApiParam(name = "followupClass", value = "随访类别【1.高血压 2.糖尿病 3高糖】", defaultValue = "1")
                              @RequestParam(value = "followupClass", required = true) String followupClass,
                              @ApiParam(name = "followupManagerStatus", value = "随访管理状态【字典FOLLOWUP_MANAGER_STATUS】", defaultValue = "1")
                              @RequestParam(value = "followupManagerStatus", required = false) String followupManagerStatus,
                              @ApiParam(name = "plandate", value = "下次随访时间", defaultValue = "2016-12-14 20:00:00")
                              @RequestParam(value = "plandate", required = false) String plandate) {
        try {
            String response = synergyManageService.addFollowup(doctor, patient, date, followupType, followupClass, followupManagerStatus,plandate);
            return write(200, "新增临时随访记录成功!", "data", response);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "新增临时随访记录失败!" + e.getMessage());
        }
    }
    @ApiOperation("保存随访项目数据")
    @RequestMapping(value = "/saveFollowupProjectData", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    public String saveFollowupProjectData(@ApiParam(name = "followup", value = "随访项目对象")
                                          @RequestParam(value = "followup", required = true)String followup ) {
        try {
            synergyManageService.saveFollowupProjectData(followup);
            return write(200, "保存随访项目数据成功!");
        } catch (Exception e) {
            error(e);
            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,"获取成功!","data",synergyManageService.customerIndex(userCode));
        }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)
@ -361,5 +440,40 @@ public class CustomerSynergyManageController extends BaseController {
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/addWorkorderCustomerLog", method = RequestMethod.POST)
    @ApiOperation(value = "添加客户操作记录")
    public String addWorkorderCustomerLog(@ApiParam(name="workorderCode",value="协同服务工单code",required = true)
                             @RequestParam(required = true)String workorderCode,
                             @ApiParam(name="workorderServiceCode",value="协同服务工单的服务对象code",required = true)
                             @RequestParam(required = true)String workorderServiceCode,
                             @ApiParam(name="userCode",value="客服code",required = false)
                             @RequestParam(required = false)String userCode,
                             @ApiParam(name="callCode",value="通话记录code",required = true)
                             @RequestParam(required = true)String callCode,
                             @ApiParam(name="status",value="状态(0、未完成,1、处理完成)",required = true)
                             @RequestParam(required = true)Integer status){
        try{
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            synergyManageService.addWorkorderCustomerLog(workorderCode,workorderServiceCode,userCode,callCode,status);
            return write(200,"保存成功");
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
    @RequestMapping(value = "adminIndex",method = RequestMethod.GET)
    @ApiOperation(value = "管理员首页")
    public String adminIndex(@ApiParam(name="userCode",value="客服code")@RequestParam(value ="userCode")String userCode){
        try{
            return write(200,"获取成功!","data",synergyManageService.customerIndex(userCode));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"获取失败!");
        }
    }
}

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

@ -6,13 +6,13 @@ import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.service.synergy.SynergyManageService;
import com.yihu.wlyy.service.synergy.SynergyWorkorderServicerLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@ -34,6 +34,8 @@ public class DoctorSynergyManageController extends BaseController {
    private SynergyManageService synergyManageService;
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    private SynergyWorkorderServicerLogService workorderServicerLogService;
    @RequestMapping(value = "workorderList", method = RequestMethod.GET)
    @ApiOperation("医生端-协同服务列表")
@ -49,6 +51,8 @@ public class DoctorSynergyManageController extends BaseController {
                                @RequestParam(value = "serviceEndTime", required = false)String serviceEndTime,
                                @ApiParam(name = "isAcceptTask", value = "1、我接收到的任务,2、我派发的任务", required = true)
                                @RequestParam(value = "isAcceptTask", required = true)Integer isAcceptTask,
                                @ApiParam(name = "keywords", value = "输入医生姓名、姓名、社保卡、身份证号码", required = false)
                                @RequestParam(value = "keywords", required = false)String keywords,
                                @ApiParam(name = "page", value = "第几页,从1开始", required = false)
                                @RequestParam(value = "page", required = false,defaultValue = "1")Integer page,
                                @ApiParam(name = "pageSize", value = "每页分页大小", required = false)
@ -57,7 +61,7 @@ public class DoctorSynergyManageController extends BaseController {
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            Map<String,Object> result = synergyManageService.workorderList(userCode,null,workorderType,null,status,null,null,null,
            Map<String,Object> result = synergyManageService.workorderList(userCode,keywords,workorderType,null,status,null,null,null,
                    null,serviceStartTime,serviceEndTime,null,null,null,1,isAcceptTask,null,null,page,pageSize);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
@ -83,7 +87,7 @@ public class DoctorSynergyManageController extends BaseController {
        }
    }
    @RequestMapping(value = "createWorkorder", method = RequestMethod.GET)
    @RequestMapping(value = "createWorkorder", method = RequestMethod.POST)
    @ApiOperation("医生端-创建协同服务")
    public String workorderList(@ApiParam(name = "workorder", value = "工单对象", required = false)
                                @RequestParam(value = "workorder")String workorder,
@ -104,4 +108,20 @@ public class DoctorSynergyManageController extends BaseController {
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "selectByWorkorderCode", method = RequestMethod.POST)
    @ApiOperation("医生端-居民列表")
    public String selectByWorkorderCode(@ApiParam(name = "workorderCode", value = "工单code", required = false)
                                            @RequestParam(value = "workorderCode", required = false)String workorderCode,
                                        @ApiParam(name = "page", value = "页码", defaultValue = "1")
                                        @RequestParam(value = "page", required = false)Integer page,
                                        @ApiParam(name = "size", value = "每页大小", defaultValue = "10")
                                            @RequestParam(value = "size", required = false)Integer size){
        try {
            return write(200, "请求成功","data",workorderServicerLogService.selectByWorkorderCode(workorderCode,page,size));
        }catch (Exception e){
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 10 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageCustomerOnlineRecordDO.java

@ -22,6 +22,7 @@ public class ManageCustomerOnlineRecordDO extends IdEntity {
    private String jobNo;//客服工号
    private String seat;//席位
    private String phone;//客服电话
    private String totalOnlineTime;//在线总时长
    @Column(name = "code")
    public String getCode() {
@ -94,4 +95,13 @@ public class ManageCustomerOnlineRecordDO extends IdEntity {
    public void setPhone(String phone) {
        this.phone = phone;
    }
    @Column(name = "total_online_time")
    public String getTotalOnlineTime() {
        return totalOnlineTime;
    }
    public void setTotalOnlineTime(String totalOnlineTime) {
        this.totalOnlineTime = totalOnlineTime;
    }
}

+ 2 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderDO.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.entity.synergy;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
@ -59,6 +60,7 @@ public class ManageSynergyWorkorderDO extends IdEntity {
    }
    @Column(name = "service_time")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm")
    public Date getServiceTime() {
        return serviceTime;
    }

+ 2 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/UserDao.java

@ -38,4 +38,6 @@ public interface UserDao extends PagingAndSortingRepository<User, Long>, JpaSpec
	User findByJobNo(String jobNo);
	List<User> findByType(int type);
}

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

@ -1,10 +1,16 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageCustomerOnlineRecordDO;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by 刘文彬 on 2018/9/27.
 */
public interface ManageCustomerOnlineRecordDao extends PagingAndSortingRepository<ManageCustomerOnlineRecordDO, Long> {
    @Query("select r from ManageCustomerOnlineRecordDO r where r.customerCode=?1 and r.createTime>=?2 and r.createTime<=?3 order by r.createTime")
    List<ManageCustomerOnlineRecordDO> findByCustomerCodeToday(String userCode,String startTime,String endTime);
}

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

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

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

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

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

@ -6,6 +6,8 @@ import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
public interface ManageSynergyWorkorderServicerDao extends PagingAndSortingRepository<ManageSynergyWorkorderServicerDO, Long> {
    @Query(" select count(1) from ManageSynergyWorkorderServicerDO s where s.workorderCode=?1 and s.status=?2 ")
@ -23,4 +25,6 @@ public interface ManageSynergyWorkorderServicerDao extends PagingAndSortingRepos
    Integer countByWorkorderCodeAndExecutorCodeAndStatus(String workorderCode,String executorCode,Integer status);
    ManageSynergyWorkorderServicerDO findByCode(String code);
    List<ManageSynergyWorkorderServicerDO> findByWorkorderCode(String workorderCode);
}

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

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

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

@ -1,19 +1,27 @@
package com.yihu.wlyy.service.synergy;
import com.yihu.wlyy.entity.*;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkordeReminderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderExecutorDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.entity.synergy.*;
import com.yihu.wlyy.repository.*;
import com.yihu.wlyy.repository.synergy.*;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import com.yihu.wlyy.util.query.BaseJpaService;
import jxl.Workbook;
import jxl.write.*;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -60,6 +68,10 @@ public class SynergyManageService extends BaseJpaService {
    private ManageSynergyWorkorderServicerLogDao manageSynergyWorkorderServicerLogDao;
    @Autowired
    private TownDao townDao;
    @Autowired
    private FastDFSUtil fastDFSUtil;
    @Autowired
    private ManageCustomerOnlineRecordDao manageCustomerOnlineRecordDao;
    /**
     * 根据服务编码获取工单
@ -114,13 +126,14 @@ public class SynergyManageService extends BaseJpaService {
                whereSql +=" and w.create_user_type=2 ";//创建人为客服
                whereSql += " and w.create_user ='"+code+"' ";
            }
        }else if(userType==3){//医生
        }else if(userType==1){//医生
            if(isAcceptTask==1){//我接收
                whereSql +=" and w.create_user_type=2 ";//创建人为客服
                whereSql += " and e.executor_code ='"+code+"' ";
            }else if(isAcceptTask==2){//我派发
                whereSql +=" and w.create_user_type=2 ";//创建人为医生
                whereSql += " and e.create_user ='"+code+"' ";
                whereSql +=" and w.create_user_type=1 ";//创建人为医生
                whereSql += " and w.create_user ='"+code+"' ";
            }
        }
@ -201,6 +214,9 @@ public class SynergyManageService extends BaseJpaService {
        String finalSql = sql+" LIMIT "+(page-1)*pageSize+","+pageSize;
        List<Map<String,Object>> resultWorkorderList = jdbcTemplate.queryForList(finalSql);
        List<Map<String,Object>> resultList = new ArrayList<>();
        ManageSynergyWorkorderServicerDO servicerDO = null;
        Patient patient =null;
        List<ManageSynergyWorkorderServicerDO> servicerList = null;
        for(Map<String,Object> one : resultWorkorderList){
            Map<String,Object> map = new HashMap<>();
            map.put("workorderCode",one.get("code"));//服务编码
@ -242,6 +258,19 @@ public class SynergyManageService extends BaseJpaService {
            map.put("finishedServicerCount",finishedServicerCount);//服务完成人数
            map.put("userName",one.get("create_user_name"));
            map.put("hospitalName",one.get("hospital_name"));
            map.put("servicerKey",one.get("servicer_key"));
            map.put("remark",one.get("remark"));
            if(workorderTypeR==0||workorderTypeR==2||workorderTypeR==3){
                servicerList = workorderServicerDao.findByWorkorderCode(one.get("code")+"");
                if(servicerList.size()>0){
                    servicerDO = servicerList.get(0);
                    patient = patientDao.findByCode(servicerDO.getServicePatientCode());
                }
                Integer age = IdCardUtil.getAgeForIdcard(patient.getIdcard());
                String sex = IdCardUtil.getSexForIdcard_new(patient.getIdcard());
                map.put("age",age);
                map.put("sex","1".equals(sex)?"男":("2".equals(sex)?"女":"未知"));
            }
            resultList.add(map);
        }
        Map<String,Object> resultMap = new HashMap<>();
@ -455,14 +484,17 @@ public class SynergyManageService extends BaseJpaService {
            resultMap.put("townName",workorderMap.get("town_name"));//所属区县
            resultMap.put("hospitalName",workorderMap.get("hospital_name"));//所属社区
            SignFamily signFamily = signFamilyDao.findSignByPatient(workorderMap.get("service_patient_code")+"");
            resultMap.put("signDoctor",signFamily.getDoctor());//签约医生(即:工单创建医生)
            resultMap.put("signDoctor",signFamily.getDoctorName());//签约医生(即:工单创建医生)
            resultMap.put("healthDoctor",signFamily.getDoctorHealthName());//健管师
            List<SignPatientLabelInfo> labelDiseaseType = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(workorderMap.get("service_patient_code")+"",  "3", 1);
            String diseaseType="";
            List<String> diseaseTypeList= new ArrayList<>();
            for(SignPatientLabelInfo one:labelDiseaseType){
                diseaseType+=","+one.getLabelName();
                diseaseTypeList.add(one.getLabel());
            }
            resultMap.put("diseaseType",StringUtils.isNotEmpty(diseaseType)?diseaseType.substring(1):"");//疾病类型
            resultMap.put("diseaseTypeCode",diseaseTypeList);//疾病类型code
            List<SignPatientLabelInfo> labelHealthType = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(workorderMap.get("service_patient_code")+"",  "2", 1);
            String healthType="";
            for(SignPatientLabelInfo one:labelHealthType){
@ -475,20 +507,22 @@ public class SynergyManageService extends BaseJpaService {
                serveType+=","+one.getLabelName();
            }
            resultMap.put("serveType",StringUtils.isNotEmpty(serveType)?serveType.substring(1):"");//服务类型
            resultMap.put("workorder",workorderMap.get("code"));//工单编号
            resultMap.put("patientCode",workorderMap.get("service_patient_code"));//居民code
            resultMap.put("doctorCode",workorderMap.get("create_user"));//创建人(医生)code
            //获取提交记录
            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());
                m.put("personal",log.getPersonal());//是否为本人
                m.put("callCode",log.getCallCode());//通话记录code
                m.put("callStatus",log.getCallStatus());//通话状态(1、正常通话,2、无人接听,3、拒接,4、占线,5、关机,6、停机,7、无法接通,8、空号错号)
                m.put("emphasis",log.getEmphasis());//是否重点患者(1、重点患者,2、非重点患者)
                m.put("followUp",log.getFollowUp());//是否跟进(1、无需跟进,2、待跟进)
                m.put("remark",log.getRemark());//备注
                m.put("returnVisit",log.getReturnVisit());//回访(1、有效回访,2、无效回访)
                resultMap.put("servicerLog",m);
            }
            return resultMap;
@ -846,6 +880,9 @@ public class SynergyManageService extends BaseJpaService {
     */
    public void createWorkorder(ManageSynergyWorkorderDO manageSynergyWorkorderDO,List<ManageSynergyWorkorderServicerDO> manageSynergyWorkorderServicerDOS){
        manageSynergyWorkorderDO.setCode(getWorkorderNo());
        manageSynergyWorkorderDO.setDel(1);
        manageSynergyWorkorderDO.setCreateTime(new Date());
        manageSynergyWorkorderDO.setStatus(1);
        ManageSynergyWorkorderDO manageSynergyWorkorderDO1 = workOrderDao.save(manageSynergyWorkorderDO);
        for (ManageSynergyWorkorderServicerDO servicerDO:manageSynergyWorkorderServicerDOS){
            servicerDO.setWorkorderType(manageSynergyWorkorderDO1.getType());
@ -868,9 +905,8 @@ public class SynergyManageService extends BaseJpaService {
     * @param followupClass
     * @param followupManagerStatus
     * @param plandate
     * @param prescriptioncode
     */
    public String addFollowup(String doctor,String patient, String date, String followupType,String followupClass,String followupManagerStatus,String plandate,String prescriptioncode){
    public String addFollowup(String doctor,String patient, String date, String followupType,String followupClass,String followupManagerStatus,String plandate){
        String response = null;
        String url = wlyyUrl + "followup/addFollowup";
        Map<String, Object> params = new HashMap<>();
@ -881,7 +917,6 @@ public class SynergyManageService extends BaseJpaService {
        params.put("followupClass",followupClass);
        params.put("followupManagerStatus",followupManagerStatus);
        params.put("plandate",plandate);
        params.put("prescriptioncode",prescriptioncode);
        try {
            response = httpClientUtil.post(url, params);
        } catch (Exception e) {
@ -1125,11 +1160,11 @@ public class SynergyManageService extends BaseJpaService {
                i++;
            }
            wwb.write();
            wwb.close();
        }catch (Exception e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }finally {
            if (wwb != null) wwb.close();
        }
    }
@ -1177,16 +1212,183 @@ public class SynergyManageService extends BaseJpaService {
        return list;
    }
    public int saveCallLabel(String callLabels,String callCode){
        String sql ="UPDATE manage_call_record SET call_label='"+callLabels+"' WHERE `code`='"+callCode+"'";
        return  jdbcTemplate.update(sql);
    }
    public int saveCallInfo(String serviceType,String serviceContent,String callCode){
        String sql ="UPDATE manage_call_record SET service_type='"+serviceType+"',service_content='"+serviceContent+"' WHERE `code`='"+callCode+"'";
        return  jdbcTemplate.update(sql);
    }
    public Map<String,Object> 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;
        for(CallRecord callRecord : waihudList){
            //获取客户未接通数量
            if(callRecord.getAnswerStatus()==3){
                customerNoCount++;
            }
        }
        //求总时长
        int seconds = totalTaklTime(waihudList);
        //求平均时长
        map.put("waihuAvgTalkTime",getAvgTime(seconds,waihudList.size()));
        map.put("waihuCount",waihudList.size());
        map.put("waihuCustomerNoCount",customerNoCount);
        //--------------今日在线时长-----------------//
        String startTime=today+" 00:00:00";
        String endTime = today+" 23:59:59";
        List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
        String onLineTime = manageCustomerOnlineRecordDOList.get(0).getTotalOnlineTime();
        for (ManageCustomerOnlineRecordDO customerOnlineRecordDO : manageCustomerOnlineRecordDOList){
        }
        //--------------今日接入量-----------------//
        List<CallRecord> jieruList = jdbcTemplate.query(callSql+" and type=1",new BeanPropertyRowMapper<>(CallRecord.class));
        //求总时长
        int jieruTotalSecond = totalTaklTime(jieruList);
        //求平均时长
        map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
        map.put("jieruCount",jieruList.size());
        //--------------今日协同任务外呼数-----------------//
        return map;
    }
    /**
     *
     * 返回总的秒数
     * @param list
     * @return
     */
    public int totalTaklTime(List<CallRecord> list){
        int hours = 0;
        int minutes = 0;
        int seconds = 0;
        for(CallRecord callRecord : list){
            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]);
                    }
                }
            }
        }
        seconds = hours*3600+minutes*60+seconds;
        return seconds;
    }
    public String getAvgTime(int totalSeconds,int count){
        int avgSeconds = totalSeconds/count;
        String avgTalkTime = "";
        avgTalkTime =avgSeconds/3600+"时";
        if (avgSeconds%3600==0){
            avgTalkTime +="0分0秒";
        }else {
            if (avgSeconds%3600%60==0){
                avgTalkTime +=avgSeconds%3600/60+"分0秒";
            }else {
                avgTalkTime +=avgSeconds%3600/60+"分"+avgSeconds%3600%60+"秒";
            }
        }
        return 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){
    @Transactional
    public void addWorkorderCustomerLog(String workorderCode,String workorderServiceCode,String userCode,String callCode,Integer status) throws  Exception{
        ManageSynergyWorkorderCustomerLogDO workorderCustomerLogDO = new ManageSynergyWorkorderCustomerLogDO();
        workorderCustomerLogDO.setCode(getCode());
        workorderCustomerLogDO.setCallCode(callCode);
        workorderCustomerLogDO.setCreateTime(new Date());
        workorderCustomerLogDO.setCreateUserCode(userCode);
        User user = userDao.findByCode(userCode);
        workorderCustomerLogDO.setCreateUserName(user.getName());
        workorderCustomerLogDO.setStatus(status);
        workorderCustomerLogDO.setWorkorderCode(workorderCode);
        workorderCustomerLogDO.setWorkorderServiceCode(workorderServiceCode);
        customerLogDao.save(workorderCustomerLogDO);
    }
//    public static void main(String[] args) {
//        String a ="group1/M00/0E/FB/rBFuWlubh7SACz32AAAde0sVAJk899.png";
//        int aa = a.lastIndexOf("/");
//        System.out.println(aa);
//        System.out.println(a.substring(0,aa));
//    }
    public void wordToPDF(String path) throws Exception{
        String groupName = path.substring(0,path.lastIndexOf("/"));
        String remoteFileName =path.substring(path.lastIndexOf("/"),path.length()-1);
        byte[] bb =FastDFSUtil.download(groupName,remoteFileName);
    }
    public Map<String,Object> adminIndex(String userCode){
        List<User> userList = userDao.findByType(4);
        Map<String,Object> map = new HashMap<>();
        String today = DateUtil.dateToStrShort(new Date());
        String callSql ="SELECT" +
                " r.*" +
                " FROM" +
                " manage_call_record r" +
                " LEFT JOIN wlyy_user u ON r.user_code = u.`code`" +
                " WHERE" +
                " u.type = 4" +
                " AND r.create_time >= '"+today+" 00:00:00'" +
                " AND r.create_time <= '"+today+" 23:59:59'";
        //--------------今日外呼量-----------------//
        List<CallRecord> waihudList = jdbcTemplate.query(callSql+" and r.type=2",new BeanPropertyRowMapper<>(CallRecord.class));
        //求总时长
        int seconds = totalTaklTime(waihudList);
        //求平均时长
        map.put("waihuAvgTalkTime",getAvgTime(seconds,waihudList.size()));
        map.put("waihuCount",waihudList.size());
        //--------------今日在线时长-----------------//
        String startTime=today+" 00:00:00";
        String endTime = today+" 23:59:59";
        List<ManageCustomerOnlineRecordDO> manageCustomerOnlineRecordDOList = manageCustomerOnlineRecordDao.findByCustomerCodeToday(userCode,startTime,endTime);
        String onLineTime = manageCustomerOnlineRecordDOList.get(0).getTotalOnlineTime();
        for (ManageCustomerOnlineRecordDO customerOnlineRecordDO : manageCustomerOnlineRecordDOList){
        }
        //--------------今日接入量-----------------//
        List<CallRecord> jieruList = jdbcTemplate.query(callSql+" and r.type=1",new BeanPropertyRowMapper<>(CallRecord.class));
        //求总时长
        int jieruTotalSecond = totalTaklTime(jieruList);
        //求平均时长
        map.put("jieruAvgTalkTime",getAvgTime(jieruTotalSecond,jieruList.size()));
        map.put("jieruCount",jieruList.size());
        //--------------今日协同任务外呼数-----------------//
        return map;
    }
}

+ 61 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyWorkorderServicerLogService.java

@ -2,14 +2,26 @@ package com.yihu.wlyy.service.synergy;/**
 * Created by nature of king on 2018/10/9.
 */
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerLogDO;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerLogDao;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author wangzhinan
@ -21,6 +33,15 @@ import java.util.Date;
public class SynergyWorkorderServicerLogService extends BaseJpaService {
    @Autowired
    private ManageSynergyWorkorderServicerLogDao manageSynergyWorkorderServicerLogDao;
    @Autowired
    private ManageSynergyWorkOrderDao manageSynergyWorkOrderDao;
    @Autowired
    private ManageSynergyWorkorderServicerDao workorderServicerDao;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
@ -30,6 +51,45 @@ public class SynergyWorkorderServicerLogService extends BaseJpaService {
     */
    public void create(ManageSynergyWorkorderServicerLogDO synergyWorkorderServicerLogDO){
        synergyWorkorderServicerLogDO.setCreateTime(new Date());
        manageSynergyWorkorderServicerLogDao.save(synergyWorkorderServicerLogDO);
        ManageSynergyWorkorderServicerLogDO workorderServicerLogDO = manageSynergyWorkorderServicerLogDao.save(synergyWorkorderServicerLogDO);
        ManageSynergyWorkorderServicerDO workorderServicerDO = workorderServicerDao.findByWorkOrderCodeAndPatientCode(workorderServicerLogDO.getWorkorderCode(),workorderServicerLogDO.getWorkorderServiceCode());
        workorderServicerDO.setStatus(3);
        workorderServicerDao.save(workorderServicerDO);
        String sql = "select * from manage_synergy_workorder_servicer where workorder_code = '"+workorderServicerLogDO.getWorkorderCode()+"' and status IN(1,2)";
        List<ManageSynergyWorkorderServicerDO> workorderServicerDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ManageSynergyWorkorderServicerDO.class));
        if (workorderServicerDOS == null || workorderServicerDOS.size() == 0){
            ManageSynergyWorkorderDO workorderDO = manageSynergyWorkOrderDao.findByCode(workorderServicerLogDO.getWorkorderCode());
            workorderDO.setStatus(3);
            manageSynergyWorkOrderDao.save(workorderDO);
        }
    }
    /**
     * 根据工单code获取服务对象
     *
     * @param workorderCode 工单code
     * @return
     */
    public JSONObject selectByWorkorderCode(String workorderCode, Integer page, Integer size){
        JSONObject object = new JSONObject();
        String sql = "select * from manage_synergy_workorder_servicer where workorder_code = '"+workorderCode+"' LIMIT "+(page-1)*size+","+size;
        List<ManageSynergyWorkorderServicerDO> workorderServicerDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ManageSynergyWorkorderServicerDO.class));
        String sqlCount = "select count(1) as total from manage_synergy_workorder_servicer where workorder_code = '"+workorderCode+"'";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        List<Patient> patients = new ArrayList<>();
        for (ManageSynergyWorkorderServicerDO workorderServicerDO:workorderServicerDOS){
            Patient patient = patientDao.findByCode(workorderServicerDO.getServicePatientCode());
            patients.add(patient);
        }
        object.put("currPage",page);
        object.put("pageSize",size);
        object.put("totalCount",count);
        object.put("detailModelList",patients);
        return object;
    }
}

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

@ -60,9 +60,9 @@ spring:
  profiles: dev
  datasource:
    wlyy:
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: root
      password: 123456
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: linzhou
      password: linzhou
    device:
      url: jdbc:mysql://172.19.103.77/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: root
@ -173,6 +173,8 @@ pushMes:
putMesType:
  #推送到redis消息类型
  wechat: wechat
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
---
spring:
  profiles: test
@ -290,6 +292,8 @@ pushMes:
putMesType:
  #推送到redis消息类型
  wechat: wechat
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
---
spring:
  profiles: prod
@ -403,4 +407,6 @@ pushMes:
  redis_prescription_title: redisPrescription
putMesType:
  #推送到redis消息类型
  wechat: wechat
  wechat: wechat
fastDFS:
  fastdfs_file_url: http://www.xmtyw.cn/

+ 1 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/JMController.java

@ -356,7 +356,7 @@ public class JMController {
			if (jsonObject.getInt("msgCode")==800){
				return Result.success("获取接种记录成功!",data);
			}else{
				return Result.error(jsonObject.getString("msg"));
				return Result.error(jsonObject.getString("body"));
			}
		} catch (Exception ex) {

+ 1 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/imm/ChildVaccinImmuneService.java

@ -121,6 +121,7 @@ public class ChildVaccinImmuneService extends BaseService {
										childImmuneVaccin.setYmbm(ymbm);
										childImmuneVaccin.setJzzc(jzzc);
										childImmuneVaccin.setJzrq(DateUtil.strToDate(vaccinJsonJSONArray.getJSONObject(j).getString("jzRq"),DateUtil.YYYY_MM_DD));
										childImmuneVaccin.setYmsx(Integer.valueOf(vaccinJsonJSONArray.getJSONObject(j).getString("ymSx")));
										childImmuneVaccin.setAlert_tag(0);
										childImmuneVaccin.setDel(0);
										childImmuneVaccin.setCreate_time(new Date());

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/specialist/SpecialistHospitalItemService.java

@ -110,7 +110,7 @@ public class SpecialistHospitalItemService extends BaseService {
    public JSONArray getHospital(String doctor, String patient, String serviceItemName) throws Exception{
        String response = null;
        JSONObject object = new JSONObject();
        String url =specialistUrl + "svr-specialist/selectByHospital1";
        String url =/*"http://localhost:10051/"*/specialistUrl + "svr-specialist/selectByHospital1";
        Map<String,String> params = new HashMap<>();
        SignFamily signFamily = new SignFamily();
        Doctor d = doctorService.findDoctorByCode(doctor);

+ 43 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/ManageSynergyService.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.service.synergy;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.followup.Followup;
@ -14,6 +15,7 @@ import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import org.apache.commons.collections.map.HashedMap;
@ -61,7 +63,7 @@ public class ManageSynergyService extends BaseService {
    }
    public String createWorkorder(String doctor, Set<String> patientSet, Integer type, String objectId, String serviceDate, Integer priority, String remark, String followupClass, String followupType){
    public String createWorkorder(String doctor, Set<String> patientSet, Integer type, String objectId, String serviceDate, Integer priority, String remark, String followupClass, String followupType) throws Exception {
        String response = null;
        JSONArray array = new JSONArray();
        String patientCode1 = null;
@ -130,17 +132,19 @@ public class ManageSynergyService extends BaseService {
        String url = customerUrl + "followup/saveFollowupProjectData";
        Map<String, String> params = new HashMap<>();
        params.put("servicers",array.toJSONString());
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        response = httpClientUtil.httpPost(url,params);
        com.alibaba.fastjson.JSONObject object1 = JSON.parseObject(response);
        if (object.getInteger("status")==200){
            return response;
        }else {
            throw new Exception("请求客服系统服务失败!");
        }
        return response;
    }
    public JSONObject workorderList(String userCode,Integer workorderType,Integer status,String serviceStartTime,String serviceEndTime,Integer isAcceptTask,Integer page,Integer pageSize) throws Exception{
    public JSONObject workorderList(String userCode,Integer workorderType,Integer status,String serviceStartTime,String serviceEndTime,Integer isAcceptTask,String keywords,Integer page,Integer pageSize) throws Exception{
        Map<String, Object> param = new HashedMap();
        param.put("userCode",userCode);
        param.put("workorderType",workorderType);
@ -148,9 +152,10 @@ public class ManageSynergyService extends BaseService {
        param.put("serviceStartTime",serviceStartTime);
        param.put("serviceEndTime",serviceEndTime);
        param.put("isAcceptTask",isAcceptTask);
        param.put("keywords",keywords);
        param.put("page",page);
        param.put("pageSize",pageSize);
        HttpResponse response = HttpUtils.doGet(customerUrl + "/doctor/synergy/workorderList", param);
        HttpResponse response = HttpUtils.doGet(customerUrl + "/synergy/doctor/workorderList", param);
        JSONObject result = new JSONObject(response.getContent());
        if(result.getInt("status")==200){
            JSONObject json = result.getJSONObject("data");
@ -171,4 +176,34 @@ public class ManageSynergyService extends BaseService {
        }
        throw new Exception("请求客服系统服务失败!");
    }
    /**
     *
     * @param workorderCode
     * @return
     * @throws Exception
     */
    public String selectByWorkorderCode(String workorderCode,Integer page,Integer size) throws Exception{
        String response = null;
        Map<String, String> params = new HashMap<>();
        params.put("workorderCode",workorderCode);
        params.put("page",page.toString());
        params.put("size",size.toString());
        String url = customerUrl + "/synergy/doctor/selectByWorkorderCode";
        com.alibaba.fastjson.JSONObject object = null;
        try {
            response = httpClientUtil.httpPost(url,params);
            object = JSON.parseObject(response);
            com.alibaba.fastjson.JSONObject jsonObject1 = object.getJSONObject("data");
            JSONArray array = jsonObject1.getJSONArray("detailModelList");
            for (int i=0;i<array.size();i++){
                com.alibaba.fastjson.JSONObject jsonObject = array.getJSONObject(i);
                jsonObject.put("age", IdCardUtil.getAgeForIdcard(jsonObject.getString("idcard")));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return object.toString();
    }
}

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

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

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java

@ -215,7 +215,7 @@ public class DoctorImmController extends BaseController {
				JSONObject json = new JSONObject(jsonObject.getString("data"));
				return write(200, "查询成功","data",json.getJSONArray("body"));
			}else {
				return error(-1,jsonObject.getString("error")+"--"+jsonObject.getString("message") );
				return error(-1,jsonObject.getString("msg") );
			}
		}catch (Exception e){
			error(e);

+ 38 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/synergy/SynergyManageController.java

@ -1,10 +1,9 @@
package com.yihu.wlyy.web.doctor.synergy;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.jimeiJkEdu.JMJkEduArticleService;
import com.yihu.wlyy.service.synergy.ManageSynergyService;
import com.yihu.wlyy.service.synergy.SynergyManageService;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -31,6 +30,8 @@ public class SynergyManageController extends BaseController {
    @Autowired
    private ManageSynergyService manageSynergyService;
    @Autowired
    private SynergyManageService synergyManageService;
    @Autowired
    private JMJkEduArticleService jmJkEduArticleService;
    @RequestMapping(value = "/getWorkOrderInfo", method = {RequestMethod.GET, RequestMethod.POST})
@ -50,11 +51,10 @@ public class SynergyManageController extends BaseController {
    }
    @RequestMapping(value = "doctorCreateSynergy", method = RequestMethod.POST)
    @ApiOperation("医生创建系统服务")
    @ObserverRequired
    public BaseResultModel doctorSendArticleToPatients(
    @ApiOperation("医生派发协同服务")
    public String doctorSendArticleToPatients(
            @RequestParam(value = "patient", required = false) String patient,
            @RequestParam(value = "group", required = false, defaultValue = "") String group,
            @RequestParam(value = "group", required = false) String group,
            @RequestParam(value = "labelType", required = false) String labelType,
            @RequestParam(value = "teamCode", required = false) Long teamCode,
            @RequestParam(value = "objectId", required = false) String objectId,
@ -69,7 +69,7 @@ public class SynergyManageController extends BaseController {
            String[] patients = new String[]{};
            String[] groups = new String[]{};
            if (StringUtils.isEmpty(patient) && StringUtils.isEmpty(group)) {
                return new BaseResultModel("请至少选择一个患者!");
                return  write(200,"请至少选择一个患者!");
            }else{
                if(StringUtils.isNotBlank(patient)){
                    if(patient.contains(",")){
@ -87,19 +87,19 @@ public class SynergyManageController extends BaseController {
                }
            }
            if (patients.length == 0 && groups.length == 0) {
                return new BaseResultModel("请至少选择一个患者!");
                return  write(200,"请至少选择一个患者!");
            }
            Set<String> patientSet = new HashSet<>(); //放入set中可以去重复
            jmJkEduArticleService.initPatients(getUID(),groups, group,labelType,teamCode,patients,patientSet);
//            jmJkEduArticleService.initPatient(getUID(),groups,group,labelType,teamCode,patients,patientSet);
            if (patientSet.size() == 0) {
                return new BaseResultModel("请至少选择一个患者!");
                return  write(200,"请至少选择一个患者!");
            }
            manageSynergyService.createWorkorder(getUID(),patientSet,type,objectId,serviceDate,priority,remark,followupClass,followupType);
            return new BaseResultModel();
            synergyManageService.createWorkorder(getUID(),patientSet,type,objectId,serviceDate,priority,remark,followupClass,followupType);
            return  write(200,"请求成功");
        } catch (Exception e) {
            error(e);
            return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
            return error(-1,"保存失败");
        }
    }
@ -117,6 +117,8 @@ public class SynergyManageController extends BaseController {
                                @RequestParam(value = "serviceEndTime", required = false)String serviceEndTime,
                                @ApiParam(name = "isAcceptTask", value = "1、我接收到的任务,2、我派发的任务", required = true)
                                @RequestParam(value = "isAcceptTask", required = true)Integer isAcceptTask,
                                @ApiParam(name = "keywords", value = "输入医生姓名、姓名、社保卡、身份证号码", required = false)
                                @RequestParam(value = "keywords", required = false)String keywords,
                                @ApiParam(name = "page", value = "第几页,从1开始", required = false)
                                @RequestParam(value = "page", required = false,defaultValue = "1")Integer page,
                                @ApiParam(name = "pageSize", value = "每页分页大小", required = false)
@ -125,7 +127,7 @@ public class SynergyManageController extends BaseController {
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            JSONObject result = manageSynergyService.workorderList(userCode,workorderType,status,serviceStartTime,serviceEndTime,isAcceptTask,page,pageSize);
            JSONObject result = manageSynergyService.workorderList(userCode,workorderType,status,serviceStartTime,serviceEndTime,isAcceptTask,keywords,page,pageSize);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);
@ -150,4 +152,27 @@ public class SynergyManageController extends BaseController {
            return error(-1, "请求失败");
        }
    }
    /**
     * 居民列表
     *
     * @param workorderCode
     * @return
     */
    @RequestMapping(value = "selectByWorkorderCode", method = RequestMethod.POST)
    @ApiOperation("医生端-居民列表")
    public String selectByWorkorderCode(@ApiParam(name = "workorderCode", value = "工单code", required = false)
                                        @RequestParam(value = "workorderCode", required = false)String workorderCode,
                                        @ApiParam(name = "page", value = "页码", defaultValue = "1")
                                        @RequestParam(value = "page", required = false)Integer page,
                                        @ApiParam(name = "size", value = "每页大小", defaultValue = "10")
                                            @RequestParam(value = "size", required = false)Integer size){
        try {
            return write(200, "请求成功","data",manageSynergyService.selectByWorkorderCode(workorderCode,page,size));
        }catch (Exception e){
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 18 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/synergy/SynergyManagerController.java

@ -26,7 +26,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
 * @desc 协同管理
 **/
@Controller
@RequestMapping(value = "/followup", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RequestMapping(value = "/synergy", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "协同管理接口")
public class SynergyManagerController extends BaseController{
    @Autowired
@ -91,6 +91,23 @@ public class SynergyManagerController extends BaseController{
        }
    }
  /*  @RequestMapping(value = "/findDictByName", method = RequestMethod.GET)
    @ApiOperation(value = "药品列表")
    public String findDictByName(@ApiParam(name = "name", value = "药品名称(中文或拼音首字母查询)", defaultValue = "胰岛素")
                                 @RequestParam(value = "name", required = false) String name,
                                 @ApiParam(name = "isinsulin", value = "是否过滤胰岛素:1非胰岛素,2胰岛素", defaultValue = "")
                                 @RequestParam(value = "isinsulin", required = false) String isinsulin) {
        try {
//            return write(200, "操作成功!", "data",zyDictService.findDictByDoctorAndName("e3b3bfb3644011e69616fa163e424525",name,isinsulin));
            return write(200, "操作成功!", "data",zyDictService.findDictByDoctorAndName(getUID(), name,isinsulin));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }*/
    @RequestMapping(value = "/questionnaire/saveResultAndAnswer", method = RequestMethod.POST)
    @ApiOperation(value = "保存用户问卷答案")
    public String saveResultAndAnswer( @ApiParam(name = "jsonData", value = "问题和答案字符串")@RequestParam(value = "jsonData") String jsonData,