Bladeren bron

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

huangwenjie 6 jaren geleden
bovenliggende
commit
85c4028cdb
42 gewijzigde bestanden met toevoegingen van 1662 en 230 verwijderingen
  1. 9 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java
  2. 4 3
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java
  3. 8 6
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerQuestionnaireController.java
  4. 5 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerScreenResultController.java
  5. 190 11
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java
  6. 4 6
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/doctor/DoctorQuestionnaireController.java
  7. 37 7
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/doctor/DoctorSynergyManageController.java
  8. 9 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java
  9. 10 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkordeReminderDO.java
  10. 6 6
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderCustomerLogDO.java
  11. 7 6
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderReserveConsultDO.java
  12. 0 10
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderServicerDO.java
  13. 6 6
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderServicerLogDO.java
  14. 6 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/filter/SessionOutTimeFilter.java
  15. 1 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/TownDao.java
  16. 4 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderCustomerLogDao.java
  17. 1 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderReminderDao.java
  18. 10 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerLogDao.java
  19. 80 6
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java
  20. 10 5
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceService.java
  21. 13 17
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManageService.java
  22. 10 19
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/ScreenResultManageService.java
  23. 520 60
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  24. 35 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyWorkorderServicerLogService.java
  25. 4 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/wechat/WechatService.java
  26. 2 2
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/desizenMan/service_project_management.jsp
  27. 4 4
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/patientDevice_list.jsp
  28. 2 2
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/patientDevice_list_js.jsp
  29. 1 1
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/specialty/index.jsp
  30. 10 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java
  31. 154 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java
  32. 5 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  33. 174 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/ManageSynergyService.java
  34. 0 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  35. 29 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/imm/DoctorImmController.java
  36. 2 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java
  37. 2 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java
  38. 153 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/synergy/SynergyManageController.java
  39. 26 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java
  40. 21 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/message/GcOtherMessageController.java
  41. 87 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/synergy/SynergyManagerController.java
  42. 1 1
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

+ 9 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java

@ -36,6 +36,7 @@ public class CallRecord extends IdEntity {
    private String  doctorName; //签约医生姓名
    private Long  adminTeamCode; //团队id
    private Integer transferState;//转接状态1.成功 2.失败
    private String callLabel;//通话标签,多个逗号隔开。
    public String getCode() {
        return code;
@ -214,4 +215,12 @@ public class CallRecord extends IdEntity {
    public void setTransferState(Integer transferState) {
        this.transferState = transferState;
    }
    public String getCallLabel() {
        return callLabel;
    }
    public void setCallLabel(String callLabel) {
        this.callLabel = callLabel;
    }
}

+ 4 - 3
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java

@ -31,7 +31,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                "/yueren/**",
                "/svr-iot/**",
                "/customer/**",
                "/doctor/**",
                "/synergy/**",
                "/third/**",
                "/admin/hos/doctor/importFromExcel",
                "/admin/hos/doctor/importData",
@ -60,7 +60,8 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                "/admin/surveyTemplateAdvice/**",
                "/admin/paylog/**",
                "/admin/static/consult/**",
                "/admin/specialist/hospitalServiceItem/importData"
                "/admin/specialist/hospitalServiceItem/importData",
                "/synergy/**"
        );
    }
@ -73,7 +74,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                .expressionHandler(webSecurityExpressionHandler())
                .antMatchers("/yueren/**").permitAll()
                .antMatchers("/svr-iot/device/**").permitAll()//物联网平台没有做登录(这里添加免登录验证)
//                .antMatchers("/admin/main").permitAll()
//                .antMatchers("/synergy/**").permitAll() //i健康平台没有做登录(这里添加免登录验证)
//                .antMatchers("/login/**").permitAll()
//                .antMatchers("/admin/**").authenticated()
                .antMatchers("/admin/**").hasRole("USER")

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

@ -7,18 +7,19 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * 客服端问卷调查
 * Created by Humingfen on 2018/9/29.
 */
@Controller
@RequestMapping(value = "/customer/question")
@Api(description = "客服端-接收问卷协同服务")
@RestController
@RequestMapping(value = "/customer/question", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "客服端-调查问卷协同服务")
public class CustomerQuestionnaireController extends BaseController {
    @Autowired
@ -68,7 +69,8 @@ public class CustomerQuestionnaireController extends BaseController {
    @ApiOperation(value = "查看调查问卷内容")
    public String getQuestionnaireDetail(@ApiParam(value = "调查问卷code") @RequestParam String surveyCode) {
        try {
            return write(200, "查询成功!", "data", questionnaireService.getQuestionnaireDetail(surveyCode));
            com.alibaba.fastjson.JSONObject jsonObject = questionnaireService.getQuestionnaireDetail(surveyCode);
            return write(200, "查询成功!", "data", jsonObject);
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
@ -82,7 +84,7 @@ public class CustomerQuestionnaireController extends BaseController {
        try {
            //判断是否有异常中断
            Integer count = synergyManageService.findExceptionCount(workorderCode, customerCode);
            return write(200, "查询成功!", "data", count);
            return write(200, "查询成功!", "data", count > 0 ? true : false);
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");

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

@ -6,18 +6,19 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * 客服端疾病筛查
 * Created by Humingfen on 2018/9/29.
 */
@Controller
@RequestMapping(value = "/customer/screen")
@Api(description = "客服端-接收问卷协同服务")
@RestController
@RequestMapping(value = "/customer/screen", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "客服端-疾病筛查协同服务")
public class CustomerScreenResultController extends BaseController {
    @Autowired

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

@ -2,6 +2,8 @@ package com.yihu.wlyy.controller.synergy.customer;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.call.CallRecord;
import com.yihu.wlyy.repository.call.CallRecordDao;
import com.yihu.wlyy.service.manager.user.UserService;
import com.yihu.wlyy.service.synergy.SynergyManageService;
import io.swagger.annotations.Api;
@ -9,26 +11,35 @@ 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.stereotype.Controller;
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 javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
 * Created by 刘文彬 on 2018/9/27.
 */
@Controller
@RequestMapping(value = "/customer")
@RestController
@RequestMapping(value = "/synergy/customer", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "集美客服系统")
public class CustomerSynergyManageController extends BaseController {
    public static final String CALL_LABEL="CALL_LABEL";
    @Autowired
    private SynergyManageService synergyManageService;
    @Autowired
    private UserService userService;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private CallRecordDao callRecordDao;
    @RequestMapping(value = "/getWorkOrderInfo", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "获取协同服务工单信息")
@ -39,11 +50,10 @@ public class CustomerSynergyManageController extends BaseController {
                                @ApiParam(name="role",value="1医生,2客服管理员,3普通客服")
                                @RequestParam(required = true)Integer role){
        try {
            return write(200,"保存成功","data", synergyManageService.getWorkOrderInfo(workorderCode, patient, role));
            return write(200,"请求成功","data", synergyManageService.getWorkOrderInfo(workorderCode, patient, role));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
            return error(-1,"请求失败");
        }
    }
@ -68,6 +78,33 @@ public class CustomerSynergyManageController extends BaseController {
    }
    @RequestMapping(value = "/labels", method = RequestMethod.GET)
    @ApiOperation("根据分组类型查找标签")
    public String labels(
            @ApiParam(name = "labelType", value = "1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true)
            @RequestParam(value = "labelType", required = true) String labelType) {
        try {
            return write(200,"保存成功", "data", synergyManageService.getLabels(labelType));
        } catch (Exception e) {
            error(e);
            return error(-1,"保存失败");
        }
    }
    @RequestMapping(value = "/unitLabels", method = RequestMethod.GET)
    @ApiOperation("根据地区查找卫计委下属单位标签")
    public String unitLabels(@ApiParam(name = "currentRoleCode", value = "地点对应的code")
                             @RequestParam(value = "currentRoleCode", required = true) String currentRoleCode,
                             @ApiParam(name = "currentRoleLevel", value = "1省2城市3区县", required = false)
                             @RequestParam(value = "currentRoleLevel", required = true) String currentRoleLevel) {
        try {
            return write(200,"获取成功", "data", synergyManageService.getUnitLabels(currentRoleCode, currentRoleLevel));
        } catch (Exception e) {
            error(e);
            return error(-1,"获取失败");
        }
    }
    @RequestMapping(value = "workorderList", method = RequestMethod.GET)
    @ApiOperation("客服系统-协同服务列表")
    public String workorderList(@ApiParam(name = "userCode", value = "客服code", required = false)
@ -82,7 +119,7 @@ public class CustomerSynergyManageController extends BaseController {
                                @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、超时,null全部", required = false)
                                @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,
@ -102,22 +139,27 @@ public class CustomerSynergyManageController extends BaseController {
                                @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,
                                @ApiParam(name = "page", value = "第几页,从1开始", required = true)
                                @RequestParam(value = "page", required = false,defaultValue = "1")Integer page,
                                @RequestParam(value = "page", required = true,defaultValue = "1")Integer page,
                                @ApiParam(name = "pageSize", value = "每页分页大小", required = true)
                                @RequestParam(value = "pageSize", required = false,defaultValue = "10")Integer pageSize){
                                @RequestParam(value = "pageSize", required = true,defaultValue = "10")Integer pageSize){
        try {
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            List<Map<String,Object>> result = synergyManageService.workorderList(userCode,keywords,workorderType,isMyTask,status,priority,timeout,workorderCode,
                    principal,serviceStartTime,serviceEndTime,patientName,ssc,idcard,userType,isAcceptTask);
            Map<String,Object> result = synergyManageService.workorderList(userCode,keywords,workorderType,isMyTask,status,priority,timeout,workorderCode,
                    principal,serviceStartTime,serviceEndTime,patientName,ssc,idcard,userType,isAcceptTask,userName,hospitalName,page,pageSize);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "/takeWorkorderNum", method = RequestMethod.GET)
    @ApiOperation(value = "获取协同服务取号信息")
    public String takeWorkorderNum(@ApiParam(name="workorderCode",value="协同服务工单code",required = false)
@ -183,4 +225,141 @@ public class CustomerSynergyManageController extends BaseController {
            return error(-1,"获取失败");
        }
    }
    @RequestMapping(value = "getCallLabelList",method = RequestMethod.GET)
    @ApiOperation(value = "显示所有通话标签")
    public String getCallLabelList(){
        try{
            String sql ="SELECT `code`,`value`,sort FROM system_dict WHERE dict_name='"+CALL_LABEL+"'";
            return write(200,"查询成功!","data",jdbcTemplate.queryForList(sql));
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查询失败!");
        }
    }
    @RequestMapping(value = "saveCallLabel",method = RequestMethod.POST)
    @ApiOperation(value = "保存所有通话标签")
    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,"保存成功!");
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败!");
        }
    }
    @RequestMapping(value = "getCallInfo",method = RequestMethod.GET)
    @ApiOperation(value = "获取通话的详情")
    public String getCallTypeAndContent(@ApiParam(name="callCode",value="通话记录code")@RequestParam(required = false)String callCode){
        try{
            CallRecord callRecord = callRecordDao.findByCode(callCode);
            return write(200,"查询成功!","data",callCode);
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"查询失败!");
        }
    }
    @RequestMapping(value = "saveCallInfo",method = RequestMethod.POST)
    @ApiOperation(value = "保存通话记录详情")
    public String saveCallInfo(@ApiParam(name="callCode",value="通话记录code")@RequestParam(value ="callCode")String callCode,
                                @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,"保存成功!");
        }catch (Exception e){
            e.printStackTrace();
            return write(-1,"保存失败!");
        }
    }
    @RequestMapping(value = "/taskSubmit", method = RequestMethod.POST)
    @ApiOperation(value = "协同任务提交")
    public String taskSubmit(@ApiParam(name="workorderCode",value="协同服务工单code",required = true)
                             @RequestParam(required = true)String workorderCode,
                             @ApiParam(name="dealResultRemark",value="说明",required = true)
                             @RequestParam(required = true)String dealResultRemark,
                             @ApiParam(name="dealResultAccessory",value="附件路径(多个用逗号隔开)",required = true)
                             @RequestParam(required = true)String dealResultAccessory){
        try{
            synergyManageService.taskSubmit(workorderCode,dealResultRemark,dealResultAccessory);
            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){
        try{
            return write(200,"获取成功!","data",synergyManageService.getDealList(idcard));
        }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 - 6
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/doctor/DoctorQuestionnaireController.java

@ -6,15 +6,15 @@ 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.QuestionnaireManageService;
import com.yihu.wlyy.service.synergy.SynergyManageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.http.MediaType;
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 java.text.SimpleDateFormat;
import java.util.List;
@ -23,8 +23,8 @@ import java.util.List;
 * 管理端问卷调查
 * Created by humingfen on 2018/9/27.
 */
@Controller
@RequestMapping(value = "/doctor")
@RestController
@RequestMapping(value = "/synergy/questionnaire", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-派发协同服务")
public class DoctorQuestionnaireController extends BaseController {
@ -32,8 +32,6 @@ public class DoctorQuestionnaireController extends BaseController {
    ObjectMapper objectMapper;
    @Autowired
    private QuestionnaireManageService questionnaireService;
    @Autowired
    private SynergyManageService synergyManageService;
    @RequestMapping(value = "/createWorkOrder", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "派发协同服务")

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

@ -1,30 +1,39 @@
package com.yihu.wlyy.controller.synergy.doctor;
import com.alibaba.fastjson.JSONArray;
import com.fasterxml.jackson.databind.ObjectMapper;
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 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;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by 刘文彬 on 2018/9/27.
 */
@Controller
@RequestMapping(value = "/doctor/synergy")
@RestController
@RequestMapping(value = "/synergy/doctor",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "医生端-协同服务")
public class DoctorSynergyManageController extends BaseController {
    @Autowired
    private SynergyManageService synergyManageService;
    @Autowired
    private ObjectMapper objectMapper;
    @RequestMapping(value = "workorderList", method = RequestMethod.GET)
    @ApiOperation("医生端-协同服务列表")
@ -48,15 +57,14 @@ public class DoctorSynergyManageController extends BaseController {
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            List<Map<String,Object>> result = synergyManageService.workorderList(userCode,null,workorderType,null,status,null,null,null,
                    null,serviceStartTime,serviceEndTime,null,null,null,1,isAcceptTask);
            Map<String,Object> result = synergyManageService.workorderList(userCode,null,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) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "reminder", method = RequestMethod.POST)
    @ApiOperation("医生端-催单")
    public String reminder(@ApiParam(name = "userCode", value = "医生code", required = false)
@ -67,11 +75,33 @@ public class DoctorSynergyManageController extends BaseController {
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            synergyManageService.reminder(workorderCode,userCode,1);
            return write(200, "请求成功");
            Integer reminderStatus = synergyManageService.reminder(workorderCode,userCode,1);
            return write(200, "请求成功","data",reminderStatus);
        }catch (Exception e){
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "createWorkorder", method = RequestMethod.GET)
    @ApiOperation("医生端-创建协同服务")
    public String workorderList(@ApiParam(name = "workorder", value = "工单对象", required = false)
                                @RequestParam(value = "workorder")String workorder,
                                @ApiParam(name = "servicers", value = "服务对象", required = false)
                                @RequestParam(value = "servicers")String servicers){
        try {
            ManageSynergyWorkorderDO workorderDO = objectMapper.readValue(workorder,ManageSynergyWorkorderDO.class);
            JSONArray jsonArray = JSONArray.parseArray(servicers);
            List<ManageSynergyWorkorderServicerDO> servicerDOS = new ArrayList<>();
            for (int i=0;i<jsonArray.size();i++){
                ManageSynergyWorkorderServicerDO servicerDO = objectMapper.readValue(jsonArray.getJSONObject(i).toJSONString(),ManageSynergyWorkorderServicerDO.class);
                servicerDOS.add(servicerDO);
            }
            synergyManageService.createWorkorder(workorderDO,servicerDOS);
            return write(200, "获取成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}

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

@ -36,6 +36,7 @@ public class CallRecord extends IdEntity {
    private String  doctorName; //签约医生姓名
    private Long  adminTeamCode; //团队id
    private Integer transferState;//转接状态1.成功 2.失败
    private String callLabel;//通话标签,多个逗号隔开。
    public String getCode() {
        return code;
@ -214,4 +215,12 @@ public class CallRecord extends IdEntity {
    public void setTransferState(Integer transferState) {
        this.transferState = transferState;
    }
    public String getCallLabel() {
        return callLabel;
    }
    public void setCallLabel(String callLabel) {
        this.callLabel = callLabel;
    }
}

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

@ -16,6 +16,7 @@ import java.util.Date;
public class ManageSynergyWorkordeReminderDO extends IdEntity {
    private String code;
    private String workorderCode;//协同服务工单code
    private String workorderServiceCode;//协同服务对象code
    private String createUser;//创建人code
    private String createUserName;//创建者姓名
    private Integer createUserType;//创建人类型(1、医生,2、客服,3、客服负责人)
@ -193,4 +194,13 @@ public class ManageSynergyWorkordeReminderDO extends IdEntity {
    public void setPriority(Integer priority) {
        this.priority = priority;
    }
    @Column(name = "workorder_service_code")
    public String getWorkorderServiceCode() {
        return workorderServiceCode;
    }
    public void setWorkorderServiceCode(String workorderServiceCode) {
        this.workorderServiceCode = workorderServiceCode;
    }
}

+ 6 - 6
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderCustomerLogDO.java

@ -17,7 +17,7 @@ public class ManageSynergyWorkorderCustomerLogDO extends IdEntity {
    private String code;
    private Date createTime;//添加时间
    private String workorderCode;//系统服务工单code
    private String servicePatientCode;//协同服务对象code
    private String workorderServiceCode;//协同服务对象code
    private String createUserCode;//创建人(客服)code
    private String createUserName;//创建人(客服)名称
    private String callCode;//通话记录code
@ -49,13 +49,13 @@ public class ManageSynergyWorkorderCustomerLogDO extends IdEntity {
        this.workorderCode = workorderCode;
    }
    @Column(name = "service_patient_code")
    public String getServicePatientCode() {
        return servicePatientCode;
    @Column(name = "workorder_service_code")
    public String getWorkorderServiceCode() {
        return workorderServiceCode;
    }
    public void setServicePatientCode(String servicePatientCode) {
        this.servicePatientCode = servicePatientCode;
    public void setWorkorderServiceCode(String workorderServiceCode) {
        this.workorderServiceCode = workorderServiceCode;
    }
    @Column(name = "create_user_code")

+ 7 - 6
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderReserveConsultDO.java

@ -32,7 +32,7 @@ public class ManageSynergyWorkorderReserveConsultDO extends IdEntity {
    private String userName;//客服姓名(创建人)
    private Date createTime;//创建时间
    private String workorderCode;//协同服务工单code
    private String servicePatientCode;//协同服务对象code
    private String workorderServiceCode;//协同服务对象code
    private String callCode;//通话记录code
    @Column(name = "code")
@ -197,15 +197,16 @@ public class ManageSynergyWorkorderReserveConsultDO extends IdEntity {
        this.workorderCode = workorderCode;
    }
    @Column(name = "service_patient_code")
    public String getServicePatientCode() {
        return servicePatientCode;
    @Column(name = "workorder_service_code")
    public String getWorkorderServiceCode() {
        return workorderServiceCode;
    }
    public void setServicePatientCode(String servicePatientCode) {
        this.servicePatientCode = servicePatientCode;
    public void setWorkorderServiceCode(String workorderServiceCode) {
        this.workorderServiceCode = workorderServiceCode;
    }
    @Column(name = "call_code")
    public String getCallCode() {
        return callCode;

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

@ -34,7 +34,6 @@ public class ManageSynergyWorkorderServicerDO extends IdEntity {
    private String townName;//区县名称
    private String relationCode;//工单类型所关联的业务code
    private String relationCodeName;//关联业务名称
    private String callCode;//通话记录code
    @Column(name = "code")
    public String getCode() {
@ -198,15 +197,6 @@ public class ManageSynergyWorkorderServicerDO extends IdEntity {
        this.relationCode = relationCode;
    }
    @Column(name = "call_code")
    public String getCallCode() {
        return callCode;
    }
    public void setCallCode(String callCode) {
        this.callCode = callCode;
    }
    @Column(name = "workorder_type")
    public Integer getWorkorderType() {
        return workorderType;

+ 6 - 6
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderServicerLogDO.java

@ -24,7 +24,7 @@ public class ManageSynergyWorkorderServicerLogDO extends IdEntity {
    private String remark;//备注
    private Date createTime;//添加时间
    private String workorderCode;//系统服务工单code
    private String servicePatientCode;//协同服务对象code
    private String workorderServiceCode;//协同服务对象code
    private String createUserCode;//创建人(客服)code
    private String createUserName;//创建人(客服)名称
    private String callCode;//通话记录code
@ -110,13 +110,13 @@ public class ManageSynergyWorkorderServicerLogDO extends IdEntity {
        this.workorderCode = workorderCode;
    }
    @Column(name = "service_patient_code")
    public String getServicePatientCode() {
        return servicePatientCode;
    @Column(name = "workorder_service_code")
    public String getWorkorderServiceCode() {
        return workorderServiceCode;
    }
    public void setServicePatientCode(String servicePatientCode) {
        this.servicePatientCode = servicePatientCode;
    public void setWorkorderServiceCode(String workorderServiceCode) {
        this.workorderServiceCode = workorderServiceCode;
    }
    @Column(name = "create_user_code")

+ 6 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/filter/SessionOutTimeFilter.java

@ -1,5 +1,7 @@
package com.yihu.wlyy.filter;
import io.vavr.match.annotation.Patterns;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;
@ -8,6 +10,7 @@ import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.regex.Pattern;
/**
 * @author lincl
@ -15,6 +18,7 @@ import java.io.IOException;
 * @created 2016/3/26
 */
@Component("loginFilter")
@Profile({ "prod"})
public class SessionOutTimeFilter extends OncePerRequestFilter {
    @Override
@ -27,7 +31,8 @@ public class SessionOutTimeFilter extends OncePerRequestFilter {
                || path.indexOf("/svr-iot") != -1
                || path.indexOf(httpServletRequest.getContextPath() + "/static") != -1
                || path.indexOf("swagger") != -1
                || path.indexOf(httpServletRequest.getContextPath() + "/v2/api-docs") != -1) {
                || path.indexOf(httpServletRequest.getContextPath() + "/v2/api-docs") != -1
                || path.indexOf("/synergy/doctor") != -1) {
            filterChain.doFilter(httpServletRequest, httpServletResponse);
            return;
        }

+ 1 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/TownDao.java

@ -5,11 +5,10 @@
 *******************************************************************************/
package com.yihu.wlyy.repository;
import com.yihu.wlyy.entity.Town;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.wlyy.entity.Town;
public interface TownDao extends PagingAndSortingRepository<Town, Long> {
	// 根據CODE查詢區縣名稱
	@Query("select p from Town p where p.code = ?1")

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

@ -4,13 +4,15 @@ import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderCustomerLogDO;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by 刘文彬 on 2018/9/30.
 */
public interface ManageSynergyWorkorderCustomerLogDao extends PagingAndSortingRepository<ManageSynergyWorkorderCustomerLogDO, Long> {
    @Query("select count(distinct l.callCode) from ManageSynergyWorkorderCustomerLogDO l where l.servicePatientCode=?1 ")
    Integer callNumByWorkorder(String servicePatientCode);
    @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);

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

@ -13,4 +13,5 @@ import java.util.List;
public interface ManageSynergyWorkorderReminderDao extends PagingAndSortingRepository<ManageSynergyWorkordeReminderDO, Long> {
    List<ManageSynergyWorkordeReminderDO> findByPrincipalCodeAndDealWith(String principalCode,Integer dealWith);
    List<ManageSynergyWorkordeReminderDO> findByWorkorderCode(String workorderCode);
}

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

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

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

@ -3,9 +3,11 @@ 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.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.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.manager.family.FamilyMemberService;
import com.yihu.wlyy.service.manager.hos.HosDoctorService;
@ -92,9 +94,11 @@ 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";
		List<Map<String,Object>> labelInfo = jdbcTemplate.queryForList(labelSql);
		resp.put("signInfo",signInfo);
		resp.put("doctors",doctors);
		resp.put("labelInfo",labelInfo);
		return resp;
	}
@ -167,7 +171,7 @@ public class CustomerService extends BaseService{
		//发送短信消息啦
		String mobile = doctor.getMobile();
		if(!StringUtils.isBlank(mobile)&&!"2".equals(type)){
			msg+="\n您可通过微信关注\"i健康智能助手\"公众号更快更便捷的获取服务信息。";
			msg+=" 您可通过微信关注\"i健康智能助手\"公众号更快更便捷的获取服务信息。";
			List<NameValuePair> par = new ArrayList<NameValuePair>();
			par.add(new BasicNameValuePair("mobiles", mobile));
			par.add(new BasicNameValuePair("content", msg));
@ -387,13 +391,83 @@ 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);
		/*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 " +
				" 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 ("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)){
		}
		//问卷调查
		if ("4".equals(type)){
		}
		//疾病筛查
		if ("5".equals(type)){
			sql="SELECT * FROM `wlyy_survey_screen_result` WHERE `code`='"+relationCode+"'";
			resultList = jdbcTemplate.queryForList(sql);
		}
		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("consultService",consultService);
		rs.put("orderService",orderService);*/
		rs.put("patientReservation",patientReservation);
		return rs;
	}

+ 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{
        
        List<WlyyPatientDeviceVO> list = new ArrayList<>();
        String sql  = "SELECT s.patient," +
        /*String sql  = "SELECT s.patient," +
                "d.id as id," +
                "d.device_id as deviceId," +
                "d.user as user," +
@ -152,7 +152,12 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
                "wlyy_sign_family s," +
                "wlyy_patient_device d," +
                "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)){
            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 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);
        list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(WlyyPatientDeviceVO.class));
        return list ;

+ 13 - 17
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManageService.java

@ -41,6 +41,8 @@ public class QuestionnaireManageService extends BaseJpaService {
    private SurveyTemplateQuestionsDao templateQuestionDao;
    @Autowired
    private SurveyQuestionResultDao questionResultDao;
    @Autowired
    private SynergyManageService synergyManageService;
    /**
@ -64,7 +66,7 @@ public class QuestionnaireManageService extends BaseJpaService {
        }
        servicer = servicer.substring(0, servicer.length()-1);
        //保存协同服务工单
        workorderDO.setCode(getCode());
        workorderDO.setCode(synergyManageService.getWorkorderNo());
        workorderDO.setStatus(1);
        workorderDO.setCreateTime(new Date());
        workorderDO.setDel(1);
@ -123,14 +125,11 @@ public class QuestionnaireManageService extends BaseJpaService {
     * @return
     */
    public JSONObject getAnswers(String templateCode) {
        String url = wlyyUrl + "doctor/questionnaire/getAnswers";
        String response = "";
        Map<String, Object> params = new HashMap<>();
        params.put("templateId", templateCode);
        try {
            response = httpClientUtil.post(url, params);
        } catch (Exception e) {
            e.printStackTrace();
        String url = wlyyUrl + "doctor/questionnaire/getAnswers?id=" + templateCode;
        String  response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功!")){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
    }
@ -168,14 +167,11 @@ public class QuestionnaireManageService extends BaseJpaService {
    }
    public JSONObject getQuestionnaireDetail(String surveyCode) {
        String url = wlyyUrl + "doctor/questionnaire/getQuestionnaireDetail";
        String response = "";
        Map<String, Object> params = new HashMap<>();
        params.put("id", surveyCode);
        try {
            response = httpClientUtil.post(url, params);
        } catch (Exception e) {
            e.printStackTrace();
        String url = wlyyUrl + "doctor/questionnaire/getQuestionnaireDetail?id=" + surveyCode;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功")){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
    }

+ 10 - 19
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/ScreenResultManageService.java

@ -7,9 +7,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by humingfen on 2018/09/29.
 */
@ -28,14 +25,11 @@ public class ScreenResultManageService {
     * @return
     */
    public JSONObject getScreenResultDetail(String code) {
        String url = wlyyUrl + "doctor/screen/getScreenResultDetail";
        String response = "";
        Map<String, String> params = new HashMap<>();
        params.put("code", code);
        try {
            response = httpClientUtil.httpPost(url, params);
        } catch (Exception e) {
            e.printStackTrace();
        String url = wlyyUrl + "doctor/screen/getScreenResultDetail?code=" + code;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功")){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
    }
@ -46,14 +40,11 @@ public class ScreenResultManageService {
     * @return
     */
    public JSONObject getScreenDetail(String templateCode) {
        String url = wlyyUrl + "/doctor/questionnaire/getAllQuestions";
        String response = "";
        Map<String, String> params = new HashMap<>();
        params.put("surveyTemplateCode", templateCode);
        try {
            response = httpClientUtil.httpPost(url, params);
        } catch (Exception e) {
            e.printStackTrace();
        String url = wlyyUrl + "/doctor/questionnaire/getAllQuestions?surveyTemplateCode=" + templateCode;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = JSONObject.parseObject(response);
        if(jsonObject.getString("msg").equals("查询成功")){
            return JSONObject.parseObject(jsonObject.getString("data"));
        }
        return JSONObject.parseObject(response);
    }

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

@ -1,16 +1,15 @@
package com.yihu.wlyy.service.synergy;
import com.yihu.wlyy.entity.*;
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.query.BaseJpaService;
import jxl.Workbook;
import jxl.write.*;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
@ -19,6 +18,8 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.text.SimpleDateFormat;
import java.util.*;
@ -57,6 +58,8 @@ public class SynergyManageService extends BaseJpaService {
    private ManageSynergyWorkorderReminderDao manageSynergyWorkorderReminderDao;
    @Autowired
    private ManageSynergyWorkorderServicerLogDao manageSynergyWorkorderServicerLogDao;
    @Autowired
    private TownDao townDao;
    /**
     * 根据服务编码获取工单
@ -88,41 +91,42 @@ public class SynergyManageService extends BaseJpaService {
     * @return
     * @throws Exception
     */
    public List<Map<String,Object>> workorderList(String code,String keywords,Integer workorderType,
    public Map<String,Object> workorderList(String code,String keywords,Integer workorderType,
                               Integer isMyTask,Integer status,Integer priority,Integer timeout,String workorderCode,
                               String principal,String serviceStartTime,String serviceEndTime,
                               String patientName,String ssc,String idcard,Integer userType,Integer isAcceptTask) throws Exception{
                               String principal,String serviceStartTime,String serviceEndTime,String patientName,String ssc,String idcard,
                               Integer userType,Integer isAcceptTask,String userName,String hospitalName,Integer page, Integer pageSize) throws Exception{
        String servicerTable = "";
        String servicerTable = " left join wlyy.manage_synergy_workorder_executor e on e.workorder_code=w.code AND e.del = 1  " ;
        String whereSql = "";
        if(userType==3){//客服管理员
            whereSql +=" and w.create_user_type=1 ";//创建人为医生
            if(isAcceptTask==3){//待接收
                whereSql +=" and w.status =1 ";
                servicerTable ="";
            }else if(isAcceptTask==4){//已接收
                whereSql +=" and w.status in (2,3) ";
            }
        }else if(userType==2){//客服
            if(isAcceptTask==1){//我接收
                whereSql +=" and w.create_user_type=1 ";//创建人为医生
                whereSql += " and e.executor_code ="+code+" ";
                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 ='"+code+"' ";
            }
        }else if(userType==3){//医生
            if(isAcceptTask==1){//我接收
                whereSql +=" and w.create_user_type=2 ";//创建人为客服
                whereSql += " and e.executor_code ="+code+" ";
                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 e.create_user ='"+code+"' ";
            }
        }
        //关键字查询
        servicerTable +=" left join wlyy.manage_synergy_workorder_servicer s on s.workorder_code=w.code ";
        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.create_user_name like '%"+keywords+"%' or s.service_patient_name like '%"+keywords+"%' " +
                    " or s.ssc like '%"+keywords+"%' or s.idcard like '%"+keywords+"%' ) ";
@ -133,7 +137,7 @@ public class SynergyManageService extends BaseJpaService {
        }
        //是否是我负责的
        if(isMyTask!=null){
            whereSql += " and e.executor_code ="+code+" and e.executor_type=1 ";
            whereSql += " and e.executor_code ='"+code+"' and e.executor_type=1 ";
        }
        //工单状态
        if(status!=null){
@ -145,7 +149,11 @@ public class SynergyManageService extends BaseJpaService {
        }
        //是否超时
        if(timeout!=null){
            whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
            if(timeout==1){
                whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
            }else if(timeout==2){
                whereSql +=" and w.service_time <='"+DateUtil.dateToStrLong(new Date())+"' ";
            }
        }
        //服务编码
        if(StringUtils.isNotEmpty(workorderCode)){
@ -164,21 +172,34 @@ public class SynergyManageService extends BaseJpaService {
        }
        //服务对象
        if(StringUtils.isNotEmpty(patientName)){
            whereSql+=" s.service_patient_name like '%"+keywords+"%' ";
            whereSql+=" and s.service_patient_name like '%"+keywords+"%' ";
        }
        //社保卡号
        if(StringUtils.isNotEmpty(ssc)){
            whereSql+=" s.ssc like '%"+keywords+"%' ";
            whereSql+=" and s.ssc like '%"+keywords+"%' ";
        }
        //身份证号
        if(StringUtils.isNotEmpty(idcard)){
            whereSql+=" s.idcard like '%"+keywords+"%' ";
            whereSql+=" and 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+
                " left join wlyy.vmanage_synergy_workorder_executor e on e.workorder_code=w.code " +
                " where w.status in (2,3) and w.del=1  " +
                " and e.del=1 "+whereSql+ " order by w.priority desc,w.service_time desc";
        List<Map<String,Object>> resultWorkorderList = jdbcTemplate.queryForList(sql);
                " where w.del=1  " +
                " and 1=1 "+whereSql+ " order by w.priority desc,w.service_time desc";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql);
        int count = 0;
        if(rstotal!=null&&rstotal.size()>0&&rstotal.get(0).get("id")!=null){
            count = rstotal.size();
        }
        String finalSql = sql+" LIMIT "+(page-1)*pageSize+","+pageSize;
        List<Map<String,Object>> resultWorkorderList = jdbcTemplate.queryForList(finalSql);
        List<Map<String,Object>> resultList = new ArrayList<>();
        for(Map<String,Object> one : resultWorkorderList){
            Map<String,Object> map = new HashMap<>();
@ -219,9 +240,16 @@ public class SynergyManageService extends BaseJpaService {
            map.put("managerName",managerName);//负责人的名称
            Integer finishedServicerCount = workorderServicerDao.findByWorkorderCodeCount(one.get("code")+"",3);
            map.put("finishedServicerCount",finishedServicerCount);//服务完成人数
            map.put("userName",one.get("create_user_name"));
            map.put("hospitalName",one.get("hospital_name"));
            resultList.add(map);
        }
        return resultList;
        Map<String,Object> resultMap = new HashMap<>();
        resultMap.put("currPage",page);
        resultMap.put("pageSize",pageSize);
        resultMap.put("totalCount",count);
        resultMap.put("detailModelList",resultList);
        return resultMap;
    }
    /**
@ -276,12 +304,13 @@ public class SynergyManageService extends BaseJpaService {
    public Map<String, Object> getWorkOrderInfo(String workorderCode, String patient, Integer role) {
        Map<String, Object> map = new HashMap<>();
        ManageSynergyWorkorderDO workorderDO = workOrderDao.findByCode(workorderCode);
        Integer status = workorderDO.getStatus();
        //存入协同服务工单信息
        map.put("code", workorderCode);
        map.put("type", workorderDO.getType());
        map.put("priority", workorderDO.getPriority());
        map.put("serviceTime", workorderDO.getServiceTime());
        map.put("status", workorderDO.getStatus());
        map.put("status", status);
        map.put("title", workorderDO.getRelationCodeName());
        map.put("remark", workorderDO.getRemark());
        map.put("createTime", workorderDO.getCreateTime());
@ -297,7 +326,7 @@ public class SynergyManageService extends BaseJpaService {
            map.put("ssc", workorderServicerDO.getSsc());
            map.put("completeTime", workorderServicerDO.getCompleteTime());
        }else {
            if(role == 3){
            if(status == 2 || status == 3){
                //获取工单完成人数
                int count = workorderServicerDao.findByWorkorderCodeCount(workorderCode, 3);
                map.put("count", count);
@ -315,26 +344,35 @@ public class SynergyManageService extends BaseJpaService {
            map.put("status", "未接收");
        }
        if(role == 3){
            //普通客服显示接收者
        if(status == 2){
            //接收者
            map.put("receiverName", workorderDO.getReceiverName());
            map.put("receiverTime", workorderDO.getReceiverTime());
            //获取负责人信息
            List<ManageSynergyWorkorderExecutorDO> managerList = workorderExecutorDao.findByWorkorderCode(workorderCode,1);
            List<ManageSynergyWorkorderExecutorDO> collaboratorList = workorderExecutorDao.findByWorkorderCode(workorderCode,2);
            String manager = managerList.size()>0 ? managerList.get(0).getExecutorName() : "";
            //获取负责人信息
            for(ManageSynergyWorkorderExecutorDO m : managerList){
                User manager = userDao.findByCode(m.getExecutorCode());
                map.put("managerName", manager.getName());
                map.put("managerJobNo", manager.getJobNo());
                map.put("managerPhone", manager.getMobile());
            }
            String collaborator = "";
            for(ManageSynergyWorkorderExecutorDO one:collaboratorList){
            for(ManageSynergyWorkorderExecutorDO one : collaboratorList){
                collaborator += "、" + one.getExecutorName();
            }
            map.put("manager", manager);//负责人
            map.put("collaboratorList", StringUtils.isNotEmpty(collaborator) ? collaborator.substring(1) : "");//参与人可能有多个
        }
        //获取处理结果
        if(workorderDO.getStatus() == 3){
            map.put("remark", workorderDO.getDealResultRemark());
        if(status == 3){
            //获取处理结果
            map.put("resultRemark", workorderDO.getDealResultRemark());
            map.put("accessory", workorderDO.getDealResultAccessory());
        }else if(status == 4){
            //获取退回原因
            map.put("returnedRemark", workorderDO.getReturnedRemark());
        }
        return map;
    }
@ -349,6 +387,7 @@ public class SynergyManageService extends BaseJpaService {
                                               String diseaseCode,String healthCode,String serveCode,Integer isFollow) throws Exception{
        String whereSql ="";
        String leftSql ="";
        String orderBySql =" l.id desc";
        if(StringUtils.isNotEmpty(townCode)){
            whereSql+=" and s.town='"+townCode+"' ";
        }
@ -373,17 +412,21 @@ public class SynergyManageService extends BaseJpaService {
        }
        if(isFollow!=null&&isFollow==1){//跟进
            leftSql+=" LEFT JOIN manage_synergy_workorder_servicer_log ll on ll.service_patient_code=s.code ";
            whereSql+=" and ll.follow_up=2 ";
            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 " +
                " from manage_synergy_workorder_servicer s " +
                " 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_customer_log l on l.service_patient_code=s.service_patient_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 "+
                whereSql+" order by l.id desc";
                whereSql+" order by "+orderBySql;
        List<Map<String,Object>> resultWorkorderList = jdbcTemplate.queryForList(sql);
        Map<String,Object> resultMap = new HashMap<>();
        if(resultWorkorderList.size()>0){
@ -393,6 +436,7 @@ public class SynergyManageService extends BaseJpaService {
            resultMap.put("patientName",workorderMap.get("service_patient_name"));//居民姓名
            Integer callNum = customerLogDao.callNumByWorkorder(workorderMap.get("servicerCode")+"");
            resultMap.put("callNum",callNum);//已呼叫次数
            resultMap.putAll(this.getPatientInfo(workorderMap.get("service_patient_code") + ""));
            Patient patient =patientDao.findByCode(workorderMap.get("service_patient_code")+"");
            Integer sex = patient.getSex();
            String sexName ="";
@ -429,6 +473,22 @@ public class SynergyManageService extends BaseJpaService {
                serveType+=","+one.getLabelName();
            }
            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;
        }else{
            throw new Exception("没有任务");
@ -454,6 +514,8 @@ public class SynergyManageService extends BaseJpaService {
            workorderDO.setReturnedRemark(jsonObject.getString("returnedRemark"));
            this.sendMessage(workorderDO, null, 26);
        }else if(status == 2){
            //设置接收时间
            workorderDO.setReceiverTime(new Date());
            //创建负责人信息
            List<ManageSynergyWorkorderExecutorDO> list = new ArrayList<>();
            String manager = jsonObject.getString("manager");
@ -473,17 +535,19 @@ public class SynergyManageService extends BaseJpaService {
            //保存协作者信息
            String collaborator = jsonObject.getString("collaborator");
            String[] collaborators = manager.split(",");
            for(String c : collaborators){
                ManageSynergyWorkorderExecutorDO executorDO = new ManageSynergyWorkorderExecutorDO();
                User u = userDao.findByCode(c);
                executorDO.setCode(getCode());
                executorDO.setWorkorderCode(code);
                executorDO.setExecutorType(1);
                executorDO.setExecutorCode(c);
                executorDO.setExecutorName(u.getName());
                executorDO.setDel(1);
                list.add(executorDO);
            if(StringUtils.isNotBlank(collaborator)) {
                String[] collaborators = collaborator.split(",");
                for (String c : collaborators) {
                    ManageSynergyWorkorderExecutorDO executorDO = new ManageSynergyWorkorderExecutorDO();
                    User u = userDao.findByCode(c);
                    executorDO.setCode(getCode());
                    executorDO.setWorkorderCode(code);
                    executorDO.setExecutorType(2);
                    executorDO.setExecutorCode(c);
                    executorDO.setExecutorName(u.getName());
                    executorDO.setDel(1);
                    list.add(executorDO);
                }
            }
            workorderExecutorDao.save(list);
        }
@ -542,10 +606,10 @@ public class SynergyManageService extends BaseJpaService {
    public Map<String, Object> loadingInfo(String workorderCode, String customerCode) {
        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 " +
        String sql = "SELECT s.service_patient_name, s.service_patient_code, s.`code`, s.hospital_name,s.town_name " +
                "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` " +
                "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";
        Map<String, Object> result = (Map<String, Object>) jdbcTemplate.queryForList(sql);
@ -555,17 +619,23 @@ public class SynergyManageService extends BaseJpaService {
        resultMap.put("hospitalName", result.get("hospital_name"));//所属社区
        Integer callNum = customerLogDao.callNumByWorkorder((String) result.get("code"));
        resultMap.put("callNum",callNum);//已呼叫次数
        resultMap.putAll(this.getPatientInfo(patientCode));
        return resultMap;
    }
    public Map<String,Object> getPatientInfo(String patientCode){
        Map<String, Object> resultMap = new HashMap<>();
        Patient patient = patientDao.findByCode(patientCode);
        Integer sex = patient.getSex();
        String sexName = "";
        if(sex==1){
            sexName="男";
        }else if(sex==2){
            sexName="女";
        if(sex == 1){
            sexName = "男";
        }else if(sex == 2){
            sexName = "女";
        }else{
            sexName="未知";
            sexName = "未知";
        }
        resultMap.put("sex",sexName);//性别
        resultMap.put("sex", sexName);//性别
        Integer age = IdCardUtil.getAgeForIdcard(patient.getIdcard());
        resultMap.put("age",age);//年龄
        SignFamily signFamily = signFamilyDao.findSignByPatient(patientCode);
@ -580,7 +650,7 @@ public class SynergyManageService extends BaseJpaService {
        List<SignPatientLabelInfo> labelHealthType = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(patientCode,  "2", 1);
        String healthType="";
        for(SignPatientLabelInfo one:labelHealthType){
            healthType+=","+one.getLabelName();
            healthType += ","+one.getLabelName();
        }
        resultMap.put("healthType", StringUtils.isNotEmpty(healthType) ? healthType.substring(1) : "");//健康情况
        List<SignPatientLabelInfo> labelServeType = signPatientLabelInfoDao.findByPatientAndLabelTypeAndStatus(patientCode,  "2", 1);
@ -612,7 +682,7 @@ public class SynergyManageService extends BaseJpaService {
        Integer myFinishedCount = workorderServicerDao.countByWorkorderCodeAndExecutorCodeAndStatus(workorderCode,userCode,3);
        resultMap.put("myFinishedCount",myFinishedCount);
        //待跟进
        Integer followCount = manageSynergyWorkorderServicerLogDao.findByWorkorderCode(workorderCode);
        Integer followCount = manageSynergyWorkorderServicerLogDao.findByWorkorderCodeAndFollowUp(workorderCode);
        resultMap.put("followCount",followCount);
        return resultMap;
    }
@ -625,8 +695,12 @@ public class SynergyManageService extends BaseJpaService {
     * @throws Exception
     */
    @Transactional
    public void reminder(String workorderCode,String userCode,Integer userType) throws Exception{
    public Integer reminder(String workorderCode,String userCode,Integer userType) throws Exception{
        Integer reminderStatus = reminderStatus(workorderCode);
        if(reminderStatus==3||reminderStatus==4){
            return reminderStatus;
        }
        ManageSynergyWorkorderDO manageSynergyWorkorderDO = workOrderDao.findByCode(workorderCode);
        if(manageSynergyWorkorderDO==null){
            throw new Exception();
@ -662,6 +736,40 @@ public class SynergyManageService extends BaseJpaService {
        workordeReminderDO.setDealWith(0);
        workordeReminderDO.setPriority(manageSynergyWorkorderDO.getPriority());
        manageSynergyWorkorderReminderDao.save(workordeReminderDO);
        return reminderStatus;
    }
    public Integer reminderStatus(String workorderCode) throws Exception{
        Integer reminderStatus=4;//默认是不满足催单条件
        ManageSynergyWorkorderDO workorderDO = workOrderDao.findByCode(workorderCode);
        //工单状态(0、草稿,1、未接受,2、处理中,3、处理完成,4、退回)
        //1、当单子超过1小时扔未被接收或退回时
        //2、当单子被接收后,如果距离服务时间小于4小时,则允许用户进行催单操作。
        //3、当已催促过客服时,再次催单
        //4、不满足催单条件时
        List<ManageSynergyWorkordeReminderDO> list = manageSynergyWorkorderReminderDao.findByWorkorderCode(workorderCode);
        if(workorderDO.getStatus()==1){
            if(list.size()>0){
                reminderStatus=3;
            }else{
                //单子超过1小时
                long h1= 60*60*1000L;
                if(new Date().getTime()-workorderDO.getCreateTime().getTime()>h1){
                    reminderStatus=1;
                }
            }
        }else if(workorderDO.getStatus()==2){
            if(list.size()>0){
                reminderStatus=3;
            }else{
                //距离服务时间小于4小时
                long h4= 4*60*60*1000L;
                if(workorderDO.getServiceTime().getTime()-new Date().getTime()<h4){
                    reminderStatus=2;
                }
            }
        }
        return reminderStatus;
    }
    /**
@ -715,4 +823,356 @@ public class SynergyManageService extends BaseJpaService {
        }
        return resultList;
    }
    /**
     * 创建工单
     *
     * @param manageSynergyWorkorderDO
     * @param manageSynergyWorkorderServicerDOS
     */
    public void createWorkorder(ManageSynergyWorkorderDO manageSynergyWorkorderDO,List<ManageSynergyWorkorderServicerDO> manageSynergyWorkorderServicerDOS){
        manageSynergyWorkorderDO.setCode(getWorkorderNo());
        ManageSynergyWorkorderDO manageSynergyWorkorderDO1 = workOrderDao.save(manageSynergyWorkorderDO);
        for (ManageSynergyWorkorderServicerDO servicerDO:manageSynergyWorkorderServicerDOS){
            servicerDO.setWorkorderType(manageSynergyWorkorderDO1.getType());
            servicerDO.setWorkorderCode(manageSynergyWorkorderDO1.getCode());
            servicerDO.setRelationCode(manageSynergyWorkorderDO1.getRelationCode());
            servicerDO.setCreateTime(new Date());
            servicerDO.setRelationCodeName(manageSynergyWorkorderDO1.getRelationCodeName());
            workorderServicerDao.save(servicerDO);
        }
    }
    /**
     * 添加随访计划
     *
     * @param doctor
     * @param patient
     * @param date
     * @param followupType
     * @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){
        String response = null;
        String url = wlyyUrl + "followup/addFollowup";
        Map<String, Object> params = new HashMap<>();
        params.put("doctor",doctor);
        params.put("patient",patient);
        params.put("date",date);
        params.put("followupType",followupType);
        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) {
            e.printStackTrace();
        }
        return response;
    }
    /**
     * 保存随访数据
     *
     * @param followup
     * @return
     */
    public String saveFollowupProjectData(String followup){
        String response = null;
        String url = wlyyUrl + "followup/saveFollowupProjectData";
        Map<String, Object> params = new HashMap<>();
        params.put("followup",followup);
        try {
            response = httpClientUtil.post(url, params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response;
    }
    @Transactional
    public void taskSubmit(String workorderCode,String dealResultRemark,String dealResultAccessory) throws Exception{
        ManageSynergyWorkorderDO manageSynergyWorkorderDO = workOrderDao.findByCode(workorderCode);
        manageSynergyWorkorderDO.setDealResultRemark(dealResultRemark);
        manageSynergyWorkorderDO.setDealResultAccessory(dealResultAccessory);
        manageSynergyWorkorderDO.setStatus(3);
        workOrderDao.save(manageSynergyWorkorderDO);
    }
    public JSONObject getLabels(String labelType) {
        String url = wlyyUrl + "/wlyygc/doctor/label/labels?labelType=" + labelType;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = new JSONObject(response);
        return  jsonObject;
    }
    public JSONObject getUnitLabels(String currentRoleCode, String currentRoleLevel) {
        String url = wlyyUrl + "/wlyygc/doctor/label/unitLabels?currentRoleCode=" + currentRoleCode + "&currentRoleLevel=" + currentRoleLevel;
        String response = httpClientUtil.get(url, "UTF-8");
        JSONObject jsonObject = new JSONObject(response);
        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,
                                Integer isMyTask,Integer status,Integer priority,Integer timeout,String workorderCode,
                                String principal,String serviceStartTime,String serviceEndTime,
                                String patientName,String ssc,String idcard,Integer userType,Integer isAcceptTask,String userName,String hospitalName,
                                HttpServletResponse response) throws Exception{
        WritableWorkbook wwb = null;
        try{
            String servicerTable = " left join wlyy.manage_synergy_workorder_executor e on e.workorder_code=w.code AND e.del = 1  " ;
            String whereSql = "";
            if(userType==3){//客服管理员
                whereSql +=" and w.create_user_type=1 ";//创建人为医生
                if(isAcceptTask==3){//待接收
                    whereSql +=" and w.status =1 ";
                    servicerTable ="";
                }else if(isAcceptTask==4){//已接收
                    whereSql +=" and w.status in (2,3) ";
                }
            }else if(userType==2){//客服
                if(isAcceptTask==1){//我接收
                    whereSql +=" and w.create_user_type=1 ";//创建人为医生
                    whereSql += " and e.executor_code ='"+code+"' ";
                }else if(isAcceptTask==2){//我派发
                    whereSql +=" and w.create_user_type=2 ";//创建人为客服
                    whereSql += " and e.create_user ='"+code+"' ";
                }
            }else if(userType==3){//医生
                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+"' ";
                }
            }
            //关键字查询
            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.create_user_name like '%"+keywords+"%' or s.service_patient_name like '%"+keywords+"%' " +
                        " or s.ssc like '%"+keywords+"%' or s.idcard like '%"+keywords+"%' ) ";
            }
            //服务类型
            if(workorderType!=null){
                whereSql += " and w.type ="+workorderType+" ";
            }
            //是否是我负责的
            if(isMyTask!=null){
                whereSql += " and e.executor_code ='"+code+"' and e.executor_type=1 ";
            }
            //工单状态
            if(status!=null){
                whereSql +=" and w.status ="+status+" ";
            }
            //优先级
            if(priority!=null){
                whereSql+= " and w.priority="+priority+" ";
            }
            //是否超时
            if(timeout!=null){
                whereSql +=" and w.service_time >'"+DateUtil.dateToStrLong(new Date())+"' ";
            }
            //服务编码
            if(StringUtils.isNotEmpty(workorderCode)){
                whereSql+=" and w.code like '%"+workorderCode+"%' ";
            }
            //负责人
            if(StringUtils.isNotEmpty(principal)){
                whereSql+=" and e.code like '%"+principal+"%' and e.executor_type=1 ";
            }
            //服务时间
            if(StringUtils.isNotEmpty(serviceStartTime)){
                whereSql+=" and w.service_time>='"+serviceStartTime+"' ";
            }
            if(StringUtils.isNotEmpty(serviceEndTime)){
                whereSql+=" and w.service_time<='"+serviceEndTime+"' ";
            }
            //服务对象
            if(StringUtils.isNotEmpty(patientName)){
                whereSql+=" s.service_patient_name like '%"+keywords+"%' ";
            }
            //社保卡号
            if(StringUtils.isNotEmpty(ssc)){
                whereSql+=" s.ssc like '%"+keywords+"%' ";
            }
            //身份证号
            if(StringUtils.isNotEmpty(idcard)){
                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+
                    " where w.del=1  " +
                    " and 1=1 "+whereSql+ " order by w.priority desc,w.service_time desc";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            //生成excel
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "patientHealthIndexDataList.xls"));
            OutputStream os = response.getOutputStream();
            wwb = Workbook.createWorkbook(os);
            WritableSheet ws = Workbook.createWorkbook(os).createSheet("sheet",1);
            List<String> header = null;
            if(isAcceptTask==1){//我接收的任务
                header = new ArrayList<>(Arrays.asList("服务编号","服务类型","创建时间","服务对象","工单状态","需求方","负责人","服务内容"));
            }else if(isAcceptTask==2){//我派发的任务
                header = new ArrayList<>(Arrays.asList("服务编号","服务类型","创建时间","服务对象","工单状态","家庭医生","所属机构","服务内容"));
            }
            int i = 0;
            for (String h : header) {
                Label label = new Label(0, i, h);
                ws.addCell(label);
                i++;
            }
            Integer workorderTypeR = null;
            String workorderTypeName = null;
            Date createTime = null;
            for(Map<String,Object> one:list){
                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++;
            }
            wwb.write();
            wwb.close();
        }catch (Exception e) {
            e.printStackTrace();
            if (wwb != null) wwb.close();
            throw e;
        }
    }
    //添加单元格内容
    public void addCell(WritableSheet ws, int row, int column, String data, String memo) throws WriteException {
        Label label = new Label(column ,row, data);
        if(!org.springframework.util.StringUtils.isEmpty(memo)){
            WritableCellFeatures cellFeatures = new WritableCellFeatures();
            cellFeatures.setComment(memo);
            label.setCellFeatures(cellFeatures);
        }
        ws.addCell(label);
    }
    public List<Map<String,Object>> getDealList(String idcard){
        Patient patient = patientDao.findByIdcard(idcard);
        if (patient==null){
            return null;
        }
        String sql ="SELECT" +
                " s.create_time," +
                " s.service_patient_name," +
                " w.priority," +
                " w.relation_code," +
                " w.relation_code_name," +
                " w.create_user_type," +
                " w.create_user_name," +
                " w.create_user," +
                " w.remark," +
                " w.service_time" +
                " FROM" +
                " `manage_synergy_workorder_servicer` s" +
                " LEFT JOIN manage_synergy_workorder w ON s.workorder_code = w.`code`" +
                " WHERE" +
                " s.service_patient_code = '"+patient.getCode()+"'" +
                " AND s.`status` = 1" +
                " ORDER BY" +
                " s.create_time" +
                " LIMIT 2";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        for (Map<String,Object> map : list){
            int isOver = isServiceOverTime(DateUtil.strToDate(String.valueOf(map.get("service_time")),DateUtil.YYYY_MM_DD_HH_MM_SS));
            map.put("isOver",isOver);
        }
        return list;
    }
    /**
     *
     * @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){
    }
}

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

@ -0,0 +1,35 @@
package com.yihu.wlyy.service.synergy;/**
 * Created by nature of king on 2018/10/9.
 */
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerLogDO;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerLogDao;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
/**
 * @author wangzhinan
 * @create 2018-10-09 15:58
 * @desc 协同服务处理操作日志
 **/
@Service
@Transactional
public class SynergyWorkorderServicerLogService extends BaseJpaService {
    @Autowired
    private ManageSynergyWorkorderServicerLogDao manageSynergyWorkorderServicerLogDao;
    /**
     * 添加协同服务处理操作日志
     *
     * @param synergyWorkorderServicerLogDO
     */
    public void create(ManageSynergyWorkorderServicerLogDO synergyWorkorderServicerLogDO){
        synergyWorkorderServicerLogDO.setCreateTime(new Date());
        manageSynergyWorkorderServicerLogDao.save(synergyWorkorderServicerLogDO);
    }
}

+ 4 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/wechat/WechatService.java

@ -56,7 +56,8 @@ public class WechatService extends BaseService {
					"a.mobile," +
					"t.openid_time," +
					"t.medicare_number,"+
					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
//					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
					"a.idcard, " +
					"a.doctor_name," +
					"a.doctor_health_name," +
					"t.sick_village_name," +
@ -79,7 +80,8 @@ public class WechatService extends BaseService {
					"a.openid_time," +
					"a.openid, " +
					"a.medicare_number," +
					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
//					"CONCAT(LEFT (a.idcard,6),'**********',RIGHT (a.idcard,2)) idcard," +
					"a.idcard, " +
					"b.doctor_name," +
					"b.doctor_health_name," +
					"b.hospital_name," +

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

@ -498,7 +498,7 @@
					console.log(t);
                    var grade = '',price = '',itemType='',hospitalGrade='';
					$('.item-title').text(t.hospitalServiceItem.serviceItemName);
                    t.hospitalServiceItem.specialistServiceItemDO.itemType == 0 ? itemType = '康健服务':itemType = '健康管理';
                    t.hospitalServiceItem.specialistServiceItemDO.itemType == 0 ? itemType = '诊疗服务':itemType = '健康服务';
					$('.item-type').text(itemType);
					$('.item-content').text(t.hospitalServiceItem.specialistServiceItemDO.content);
					$('.item-chuwai').text(t.hospitalServiceItem.specialistServiceItemDO.excludeContent);
@ -863,7 +863,7 @@
                            xiangmuContent = res.data.detailModelList[0];
                            res.data.detailModelList[0].forEach(function (item) {
                                var t = {};
                                t.text = item.hospitalServiceItem.specialistServiceItemDO.diseaseItem;
                                t.text = item.hospitalServiceItem.serviceItemName;
                                t.code = item.hospitalServiceItem.id
                                serverData[0].nodes.push(t)
                            });

+ 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-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"/>
			</div>
			</div>--%>
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_device_name" placeholder="请输入设备名称" class="f-ml10" data-attr-scan="deviceName"/>
			</div>
@ -32,9 +32,9 @@
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_user_name" placeholder="请输入居民姓名" class="f-ml10" data-attr-scan="userName"/>
			</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"/>
			</div>
			</div>--%>
			<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" >
					<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: '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: 'doctorHealthName', width: '5%', align: "left"},
                            {display: '健管师', name: 'doctorHealthName', width: '5%', align: "left"},*/
							{display: '居民姓名', name: 'userName', width: '5%', align: "center"},
							{
								display: '绑定按键', name: 'userType', width: '5%', align: "center",

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/specialty/index.jsp

@ -387,7 +387,7 @@
                    success:function (res) {
                        console.log(res)
                        layer.msg('删除成功', {icon: 1});
                        grid.deleteRow(rowindex)
                        init();
                    }
                })
            }, function(){

+ 10 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java

@ -312,9 +312,13 @@ public class SurveyScreenResultService extends BaseService {
            Map<String, Object> map = new HashMap<>();
            map.put("question", surveyTemplateQuestions);
            String qusCode = surveyTemplateQuestions.getCode();
            for (Map<String, Object> option : optionAnswersList) {
                if (option.get("question_code").equals(qusCode)) {
                    map.put("option", option);
            if (optionAnswersList==null || optionAnswersList.size()==0){
                map.put("option",new HashMap<String,Object>());
            }else {
                for (Map<String, Object> option : optionAnswersList) {
                    if (option.get("question_code").equals(qusCode)) {
                        map.put("option", option);
                    }
                }
            }
            answerMap.put(surveyTemplateQuestions.getSort() + "", map);
@ -1124,7 +1128,7 @@ public class SurveyScreenResultService extends BaseService {
     * @return
     * @throws Exception
     */
    public String createWorkOrder(String jsonData, List<Map<String, Object>> patientInfo, String doctor) throws Exception {
    public JSONObject createWorkOrder(String jsonData, List<Map<String, Object>> patientInfo, String doctor) throws Exception {
        JSONObject object = new JSONObject(jsonData);
        JSONArray patientInfos = new JSONArray(patientInfo);
        //获取关联业务名称
@ -1145,8 +1149,8 @@ public class SurveyScreenResultService extends BaseService {
        param.put("patientInfo", patientInfos.toString());
        param.put("jsonData", object.toString());
        HttpResponse response = null;
        response = HttpUtils.doPost(customerUrl + "doctor/createWorkOrder", param);
        response = HttpUtils.doPost(customerUrl + "synergy/questionnaire/createWorkOrder", param);
        JSONObject rs = new JSONObject(response.getContent());
        return rs.getString("message");
        return rs;
    }
}

+ 154 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java

@ -17,6 +17,7 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.third.guahao.ImmuneService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import io.searchbox.client.JestClient;
import org.apache.commons.lang.StringUtils;
@ -128,21 +129,56 @@ public class ChildFamilyImmuneService extends BaseService {
	/**
	 * 获取签约居民待接种疫苗列表
	 * @param doctorcode
	 * @param doctorcode,limitType 1要分页 0不用分页
	 * @return
	 */
	public List<Map<String,Object>> getImmVaccinList(String doctorcode,int pageNo,int pageSize) {
		String sql = "select t.*,m.family_name,m.child_name,m.birthday from wlyy_child_immune_vaccin t " +
	public List<Map<String,Object>> getImmVaccinList(String doctorcode,int pageNo,int pageSize,int limitType) {
		String sql = "select DISTINCT t.*,m.child_name,m.birthday,m.childCode from wlyy_child_immune_vaccin t " +
				" inner join ( " +
				" select a.*,b.name as family_name ,c.name as child_name,c.barcode as barcode ,c.birthday as birthday from  wlyy_child_family_immune a " +
				" select a.*,b.name as family_name ,c.name as child_name,c.barcode as barcode ,c.birthday as birthday,c.`code` AS childCode from  wlyy_child_family_immune a " +
				" inner join (select patient,name from wlyy_sign_family where type in (1,2) and `status` = 1 and expenses_status = 1 and doctor = '"+doctorcode+"') b " +
				" on a.family_code = b.patient " +
				" left join wlyy_child_info c on c.`code` = a.child_code " +
				") m on m.barcode = t.barcode ";
		int start = (pageNo-1)*pageSize;
		sql +=" limit "+start+","+pageSize;
		if (limitType==1){
			int start = (pageNo-1)*pageSize;
			sql +=" limit "+start+","+pageSize;
		}
		List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql);
		for (Map<String,Object> map : rs){
			String childCode = String.valueOf(map.get("childCode"));
			String familyName="";
			String familySql ="SELECT" +
					" a.*, b. NAME AS family_name," +
					" c. NAME AS child_name," +
					" c.barcode AS barcode," +
					" c.birthday AS birthday," +
					" c.`code` AS childCode" +
					" FROM" +
					" wlyy_child_family_immune a" +
					" INNER JOIN (" +
					" SELECT" +
					" patient," +
					" NAME" +
					" FROM" +
					" wlyy_sign_family" +
					" WHERE" +
					" type IN (1, 2)" +
					" AND `status` = 1" +
					" AND expenses_status = 1" +
					" AND doctor = '"+doctorcode+"'" +
					" ) b ON a.family_code = b.patient" +
					" LEFT JOIN wlyy_child_info c ON c.`code` = a.child_code where  a.child_code='"+childCode+"'";
			List<Map<String,Object>> familyList = jdbcTemplate.queryForList(familySql);
			for (Map<String,Object> map1 : familyList){
				familyName +=String.valueOf(map1.get("family_name"))+"、";
			}
			if (familyName.length()>1){
				familyName = familyName.substring(0,familyName.length()-1);
			}
			map.put("family_name",familyName);
		}
		return rs;
	}
@ -157,9 +193,10 @@ public class ChildFamilyImmuneService extends BaseService {
		return childImmuneVaccinDao.getChildImmuneVaccinByBarcode(barcode);
	}
	public boolean alertImmVacclinByChildInfoCodes(String alertDataJsonStr, String doctor)throws Exception{
	public int alertImmVacclinByChildInfoCodes(String alertDataJsonStr, String doctor)throws Exception{
		if (StringUtils.isEmpty(alertDataJsonStr)){
			return false;
			return -1;
		}
		Doctor doctorObj = doctorDao.findByCode(doctor);
		String doctorName = "";
@ -197,6 +234,9 @@ public class ChildFamilyImmuneService extends BaseService {
					" cfi.child_code = '"+childCode+"'" +
					" AND cfi.del = 0 and (p.openid is not null or p.openid !='')";
			List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
			if (list.size()==0){
				return -10000;
			}
			List<String> openIdList = new ArrayList<>();
			for (Map<String,Object> map : list){
				//如果父母亲都在就都发
@ -239,7 +279,93 @@ public class ChildFamilyImmuneService extends BaseService {
			}
		}
		//保存到es的提醒日志表中
		return esSavePatientRemindRecord(patientRemindRecordESDOList);
		esSavePatientRemindRecord(patientRemindRecordESDOList);
		return 200;
	}
	public int alertImmVacclinByChildInfoCode(String alertDataJsonStr, String doctor)throws Exception{
		if (StringUtils.isEmpty(alertDataJsonStr)){
			return -1;
		}
		Doctor doctorObj = doctorDao.findByCode(doctor);
		String doctorName = "";
		String doctorLevel = "";
		if (doctorObj!=null){
			doctorName = doctorObj.getName();
			if (doctorObj.getLevel()==1) {
				doctorLevel="专科";
			}
			if (doctorObj.getLevel()==2) {
				doctorLevel="全科";
			}
			if (doctorObj.getLevel()==3){
				doctorLevel="健管";
			}
		}
		List<PatientRemindRecordESDO> patientRemindRecordESDOList = new ArrayList<>();
		JSONObject jsonObject = new JSONObject(alertDataJsonStr);
		String childCode = jsonObject.getString("childCode");
		String childName = jsonObject.getString("childName");
		String vaccinName = jsonObject.getString("vaccinName");
		String vaccinCode = jsonObject.getString("vaccinCode");
		String sql ="SELECT" +
				" cfi.relation," +
				" p.`code`," +
				" p.`name`," +
				" p.openid" +
				" FROM" +
				" wlyy_child_family_immune cfi" +
				" LEFT JOIN wlyy_patient p ON cfi.family_code = p.`code`" +
				" WHERE" +
				" cfi.child_code = '"+childCode+"'" +
				" AND cfi.del = 0 and (p.openid is not null or p.openid !='')";
		List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
		if (list.size()==0){
			return -10000;
		}
		List<String> openIdList = new ArrayList<>();
		for (Map<String,Object> map : list){
			//如果父母亲都在就都发
			if (!openIdList.contains(String.valueOf(map.get("openid")))){
				if (("1".equals(String.valueOf(map.get("relation"))) || "2".equals(String.valueOf(map.get("relation")))) && StringUtils.isNotBlank(String.valueOf(map.get("openid")))){
					boolean flag =true;
					try {
						WechatTemplateConfig temp = templateConfigDao.findByScene("template_deal_with", "ymjztx");
						JSONObject json = new JSONObject();
						json.put("toUser",String.valueOf(map.get("code")));
						json.put("keyword1", temp.getKeyword1().replace("key1",DateUtil.dateToStr(new Date(), "yyyy-MM-dd")));
						json.put("keyword2", temp.getKeyword2().replace("key1", doctorName+"("+doctorLevel+")"));
						json.put("remark", temp.getRemark());
						json.put("first", temp.getFirst().replace("key1",String.valueOf(map.get("name"))).replace("key2", childName).replace("key3",vaccinName));
						logger.info("weiTempJOSN:"+json.toString());
						pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 24,String.valueOf(map.get("openid")) , String.valueOf(map.get("name")), json);
					}catch (Exception e){
						e.printStackTrace();
						flag = false;
					}
					//发送微信消息并且插入一条es提醒数据
					PatientRemindRecordESDO patientRemindRecordESDO =  new PatientRemindRecordESDO();
					patientRemindRecordESDO.setCode(getCode());
					patientRemindRecordESDO.setPatient(String.valueOf(map.get("code")));
					patientRemindRecordESDO.setPatientName(String.valueOf(map.get("name")));
					patientRemindRecordESDO.setDoctor(doctor);
					patientRemindRecordESDO.setDoctorName(doctorName);
					patientRemindRecordESDO.setCreateDate(new Date());
					patientRemindRecordESDO.setRemindType(1);
					if (flag) {
						patientRemindRecordESDO.setStatus(1);
						String update="UPDATE wlyy_child_immune_vaccin SET alert_tag=1,alert_time='"+DateUtil.dateToStr(new Date(),DateUtil.YYYY_MM_DD_HH_MM_SS)+"' where `code`='"+vaccinCode+"'";
						jdbcTemplate.update(update);
					}else {
						patientRemindRecordESDO.setStatus(0);
					}
					patientRemindRecordESDOList.add(patientRemindRecordESDO);
				}
			}
		}
		//保存到es的提醒日志表中
		esSavePatientRemindRecord(patientRemindRecordESDOList);
		return 200;
	}
@ -371,4 +497,22 @@ public class ChildFamilyImmuneService extends BaseService {
		}
		return result;
	}
	public int alertImmVacclinByDoctor(String doctor)throws Exception{
		List<Map<String, Object>> immVaccinList = getImmVaccinList(doctor,0,0,0);
		String alertJsonStr="";
		JSONArray jsonArray = new JSONArray();
		if (immVaccinList != null) {
			for (Map<String, Object> map : immVaccinList) {
				JSONObject jsonObject = new JSONObject();
				jsonObject.put("vaccinCode",map.get("code"));//待接种疫苗记录code
				jsonObject.put("childName", map.get("child_name"));//儿童姓名
				jsonObject.put("childCode", map.get("childCode"));//儿童code
				jsonObject.put("vaccinName", map.get("ymmc"));//疫苗名称
				jsonArray.put(jsonObject);
			}
		}
		alertJsonStr = jsonArray.toString();
		return alertImmVacclinByChildInfoCodes(alertJsonStr,doctor);
	}
}

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

@ -1918,19 +1918,20 @@ public class ManagerQuestionnaireService extends BaseService {
     * @return
     * @throws Exception
     */
    public String createWorkOrder(String jsonData, List<Map<String, Object>> patientInfo, String doctor) throws Exception{
    public JSONObject createWorkOrder(String jsonData, List<Map<String, Object>> patientInfo, String doctor) throws Exception{
        JSONObject object = new JSONObject(jsonData);
        JSONArray patientInfos = new JSONArray(patientInfo);
        Doctor d = doctorService.findDoctorByCode(doctor);
        object.put("createUser", d.getCode());
        object.put("createUserName", d.getName());
        object.put("createUserType", 1);
        Map<String, Object> param = new HashedMap();
        param.put("patientInfo", patientInfo.toString());
        param.put("patientInfo", patientInfos.toString());
        param.put("jsonData", object.toString());
        HttpResponse response = null;
        response = HttpUtils.doPost(customerUrl + "doctor/createWorkOrder", param);
        response = HttpUtils.doPost(customerUrl + "synergy/questionnaire/createWorkOrder", param);
        JSONObject rs = new JSONObject(response.getContent());
        return rs.getString("message");
        return rs;
    }
    /**

+ 174 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/synergy/ManageSynergyService.java

@ -0,0 +1,174 @@
package com.yihu.wlyy.service.synergy;
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.DateUtil;
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.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 ManageSynergyService 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){
        String response = null;
        JSONArray array = new JSONArray();
        String patientCode1 = null;
        Doctor doctor1 = doctorDao.findByCode(doctor);
        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());
            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);
        }
        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);
        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());
            }
            followup.setFollowupDate(DateUtil.strToDate(serviceDate));
            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 + "followup/saveFollowupProjectData";
        Map<String, String> params = new HashMap<>();
        params.put("servicers",array.toJSONString());
        try {
            response = httpClientUtil.httpPost(url,params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return response;
    }
    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 Integer 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){
            Integer reminderStatus = (Integer) result.get("data");
            return reminderStatus;
        }
        throw new Exception("请求客服系统服务失败!");
    }
}

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


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

@ -97,13 +97,15 @@ public class DoctorImmController extends BaseController {
				doctorCode = getUID();
			}
			
			List<Map<String, Object>> immrs = childFamilyImmuneService.getImmVaccinList(doctorCode,Integer.valueOf(pageNo),Integer.valueOf(pageSize));
			List<Map<String, Object>> immrs = childFamilyImmuneService.getImmVaccinList(doctorCode,Integer.valueOf(pageNo),Integer.valueOf(pageSize),1);
			JSONArray jsonArray = new JSONArray();
			if (immrs != null) {
				for (Map<String, Object> map : immrs) {
					JSONObject json = new JSONObject();
					json.put("vaccin_code",map.get("code"));
					json.put("family_name", map.get("family_name"));//关联居民
					json.put("child_name", map.get("child_name"));//儿童姓名
					json.put("child_code",map.get("childCode"));//儿童信息code
					json.put("birthday", map.get("birthday"));//儿童生日
					json.put("ymmc", map.get("ymmc"));//疫苗名称
					json.put("ymkc", map.get("ymkc"));//true:可约,false:不可约
@ -128,7 +130,13 @@ public class DoctorImmController extends BaseController {
	public String alertImmVacclinByDoctor(@ApiParam(name = "doctorcode", value = "医生CODE", defaultValue = "")
	                                      @RequestParam(value = "doctorcode", required = true) String doctorcode){
		try {
			// TODO: 2018/6/21
			int result = childFamilyImmuneService.alertImmVacclinByDoctor(doctorcode);
			if (result==-1){
				return error(-1, "参数错误!");
			}
			if (result==-10000){
				return error(-1, "该儿童父母数据为空,请联系管理员!");
			}
			return write(200, "请求成功");
		} catch (Exception e) {
			e.printStackTrace();
@ -161,6 +169,25 @@ public class DoctorImmController extends BaseController {
			return error(-1, "查询失败");
		}
	}
	@RequestMapping(value = "/alertImmVacclinByChildInfoCode", method = RequestMethod.POST)
	@ApiOperation(value = "医生提醒居民疫苗接种")
	public String alertImmVacclinByChildInfoCode(@ApiParam(name = "alertDataJsonStr", value = "{\"childCode\":\"123\",\"childName\":\"张三\",\"vaccinCode\":\"asd123\",\"vaccinName\":\"疫苗名称\"}", defaultValue = "")
												  @RequestParam(value = "alertDataJsonStr", required = true) String alertDataJsonStr){
		try {
			int result = childFamilyImmuneService.alertImmVacclinByChildInfoCode(alertDataJsonStr,getUID());
			if (result==-1){
				return error(-1, "参数错误!");
			}
			if (result==-10000){
				return error(-1, "该儿童父母数据为空,请联系管理员!");
			}
			return write(200, "请求成功");
		} catch (Exception e) {
			e.printStackTrace();
			return error(-1, "查询失败");
		}
	}
	
	@RequestMapping(value = "/getPatientImmVacclin", method = RequestMethod.GET)
	@ApiOperation(value = "根据儿童免疫条码获取待接种疫苗")

+ 2 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java

@ -16,11 +16,7 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
@ -29,7 +25,7 @@ import java.util.Map;
 * 医生端-疾病筛查
 * Created by zhangdan on 2018/7/2.
 */
@Controller
@RestController
@RequestMapping(value = "/doctor/screen")
@Api(description = "医生端-疾病筛查")
public class DoctorSurveyScreenResultController extends WeixinBaseController {

+ 2 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java

@ -21,11 +21,7 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.Date;
@ -37,7 +33,7 @@ import java.util.Map;
 * 管理端问卷调查 manager路径需要验证
 * Created by Reece on 2017/3/7.
 */
@Controller
@RestController
@RequestMapping(value = "/doctor/questionnaire")
@Api(description = "管理端问卷调查")
public class ManagerQuestionnaireController extends WeixinBaseController {

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

@ -0,0 +1,153 @@
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.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;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
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 java.util.HashSet;
import java.util.Set;
/**
 * Created by humingfen on 2018/10/9.
 */
@RestController
@RequestMapping(value = "/doctor/customer", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "集美客服系统")
public class SynergyManageController extends BaseController {
    @Autowired
    private ManageSynergyService manageSynergyService;
    @Autowired
    private JMJkEduArticleService jmJkEduArticleService;
    @RequestMapping(value = "/getWorkOrderInfo", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "获取协同服务工单信息")
    public String getWorkOrderInfo(@ApiParam(name="workorderCode", value="协同服务工单code")
                                   @RequestParam(required = true)String workorderCode,
                                   @ApiParam(name="patient", value="居民code")
                                   @RequestParam(required = false)String patient,
                                   @ApiParam(name="role", value="1医生,2客服管理员,3普通客服")
                                   @RequestParam(required = true)Integer role){
        try {
            return write(200,"保存成功","data", manageSynergyService.getWorkOrderInfo(workorderCode, patient, role));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
    @RequestMapping(value = "doctorCreateSynergy", method = RequestMethod.POST)
    @ApiOperation("医生创建系统服务")
    @ObserverRequired
    public BaseResultModel doctorSendArticleToPatients(
            @RequestParam(value = "patient", required = false) String patient,
            @RequestParam(value = "group", required = false, defaultValue = "") String group,
            @RequestParam(value = "labelType", required = false) String labelType,
            @RequestParam(value = "teamCode", required = false) Long teamCode,
            @RequestParam(value = "objectId", required = false) String objectId,
            @RequestParam(value = "type",required = false)Integer type,
            @RequestParam(value = "serviceDate",required = false)String serviceDate,
            @RequestParam(value = "priority",required = false)Integer priority,
            @RequestParam(value = "remark",required = false)String remark,
            @RequestParam(value = "followupClass",required = false)String followupClass,
            @RequestParam(value = "followupType",required = false)String followupType){
        try {
            String[] patients = new String[]{};
            String[] groups = new String[]{};
            if (StringUtils.isEmpty(patient) && StringUtils.isEmpty(group)) {
                return new BaseResultModel("请至少选择一个患者!");
            }else{
                if(StringUtils.isNotBlank(patient)){
                    if(patient.contains(",")){
                        patients = patient.split(",");
                    }else{
                        patients = new String[]{patient};
                    }
                }
                if(StringUtils.isNotBlank(group)){
                    if(group.contains(",")){
                        groups = group.split(",");
                    }else{
                        groups = new String[]{group};
                    }
                }
            }
            if (patients.length == 0 && groups.length == 0) {
                return new BaseResultModel("请至少选择一个患者!");
            }
            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("请至少选择一个患者!");
            }
            manageSynergyService.createWorkorder(getUID(),patientSet,type,objectId,serviceDate,priority,remark,followupClass,followupType);
            return new BaseResultModel();
        } catch (Exception e) {
            error(e);
            return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(), BaseResultModel.statusEm.opera_error.getMessage() + ":" + e.getMessage());
        }
    }
    @RequestMapping(value = "workorderList", method = RequestMethod.GET)
    @ApiOperation("医生端-协同服务列表")
    public String workorderList(@ApiParam(name = "userCode", value = "医生code", required = false)
                                @RequestParam(value = "userCode", required = false)String userCode,
                                @ApiParam(name = "workorderType", value = "服务类型(0、咨询,1、健康教育,2、预约,3、随访,4、问卷调查,5、疾病筛查)", required = false)
                                @RequestParam(value = "workorderType", required = false)Integer workorderType,
                                @ApiParam(name = "status", value = "工单状态(0、草稿,1、未接受,2、处理中,3、处理完成,4、退回)", required = false)
                                @RequestParam(value = "status", required = false)Integer status,
                                @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 = "isAcceptTask", value = "1、我接收到的任务,2、我派发的任务", required = true)
                                @RequestParam(value = "isAcceptTask", required = true)Integer isAcceptTask,
                                @ApiParam(name = "page", value = "第几页,从1开始", required = false)
                                @RequestParam(value = "page", required = false,defaultValue = "1")Integer page,
                                @ApiParam(name = "pageSize", value = "每页分页大小", required = false)
                                @RequestParam(value = "pageSize", required = false,defaultValue = "10")Integer pageSize){
        try {
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            JSONObject result = manageSynergyService.workorderList(userCode,workorderType,status,serviceStartTime,serviceEndTime,isAcceptTask,page,pageSize);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
    @RequestMapping(value = "reminder", method = RequestMethod.POST)
    @ApiOperation("医生端-催单")
    public String reminder(@ApiParam(name = "userCode", value = "医生code", required = false)
                           @RequestParam(value = "userCode", required = false)String userCode,
                           @ApiParam(name = "workorderCode", value = "协同服务工单code", required = true)
                           @RequestParam(value = "workorderCode", required = true)String workorderCode){
        try {
            if(!StringUtils.isNotEmpty(userCode)){
                userCode = getUID();
            }
            Integer reminderStatus = manageSynergyService.reminder(userCode,workorderCode);
            return write(200, "请求成功","data",reminderStatus);
        }catch (Exception e){
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 26 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.web.patient.family;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.imm.ChildImmuneVaccin;
import com.yihu.wlyy.entity.imm.ChildInfo;
import com.yihu.wlyy.entity.imm.ChildInfoVO;
@ -10,6 +11,7 @@ import com.yihu.wlyy.repository.patient.PatientFamilyMemberDao;
import com.yihu.wlyy.service.app.family.FamilyMemberService;
import com.yihu.wlyy.service.imm.ChildFamilyImmuneService;
import com.yihu.wlyy.service.imm.ChildInfoService;
import com.yihu.wlyy.service.third.guahao.ImmuneService;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
@ -44,6 +46,8 @@ public class FamilyMemberController extends WeixinBaseController {
    private ChildInfoService childInfoService;
    @Autowired
    private ChildFamilyImmuneService childFamilyImmuneService;
    @Autowired
    private ImmuneService immuneService;
    
    /**
@ -556,4 +560,26 @@ public class FamilyMemberController extends WeixinBaseController {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "/imm/findYzymBymykh", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:获取计划免疫接种记录")
    public String findWzymBymykh (@ApiParam(name = "barCode", value = "条形编码", defaultValue = "0052248552")
                                  @RequestParam(value = "barCode", required = true) String barCode){
        try{
            String re = immuneService.findYzymBymykh(barCode);
            JSONObject jsonObject = new JSONObject(re);
            if (jsonObject.getInt("status")==200){
                JSONObject json = new JSONObject(jsonObject.getString("data"));
                return write(200, "查询成功","data",json.getJSONArray("body"));
            }else {
                return error(-1,jsonObject.getString("error")+"--"+jsonObject.getString("message") );
            }
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
}

+ 21 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/message/GcOtherMessageController.java

@ -1,7 +1,9 @@
package com.yihu.wlyy.web.third.gateway.controller.message;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.common.SMSService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.NetworkUtil;
@ -45,11 +47,9 @@ public class GcOtherMessageController {
    @Autowired
    private WeiXinTempMsgSendUtils weiXinTempMsgSendUtils;
    @Autowired
    private PatientService patientService;
    @Autowired
    private SMSService smsService;
    @Autowired
    private PatientDao patientDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Value("${wechat.message.template_consult_notice}")
    private String templateId;
@ -78,6 +78,14 @@ public class GcOtherMessageController {
            System.out.println("param3-------"+type);
            System.out.println("param4-------"+url);
            Patient patient =  patientDao.findBySsc(cardNo);
            SignFamily signFamily = null;
            if (patient!=null){
                signFamily = signFamilyDao.findByPatient(patient.getCode());
            }
            if (signFamily==null){
                return new BaseResultModel(BaseResultModel.statusEm.opera_error.getCode(),BaseResultModel.statusEm.opera_error.getMessage()+"签约信息错误!");
            }
            String templateId = "";
            if ("1".equals(type)){
                templateId=template_to_be_pay;
@ -86,8 +94,16 @@ public class GcOtherMessageController {
            }
            System.out.println("接收者id----"+patient.getOpenid());
            System.out.println("消息模板id----"+templateId);
            weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(templateJson));
            /*if ("oULM4xNdf4lqcjuq0-MGFRuhOcz8".equals(patient.getOpenid())){
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(templateJson));
            }*/
            if ("3502110100".equals(signFamily.getHospital())){
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(templateJson));
            }
            if ("oULM4xPHQO1MYOPJdI9AtVKx3fIo".equals(patient.getOpenid())){
                weiXinTempMsgSendUtils.sendTemplateMessage(templateId, patient.getOpenid(), url, new JSONObject(templateJson));
            }
            return new BaseResultModel(BaseResultModel.statusEm.success.getCode(),BaseResultModel.statusEm.success.getMessage());
        } catch (Exception e) {
            e.printStackTrace();

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

@ -0,0 +1,87 @@
package com.yihu.wlyy.web.third.synergy;/**
 * Created by nature of king on 2018/10/8.
 */
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.followup.FollowUpService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
/**
 * @author wangzhinan
 * @create 2018-10-08 13:56
 * @desc 协同管理
 **/
@Controller
@RequestMapping(value = "/followup", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "协同管理接口")
public class SynergyManagerController extends BaseController{
    @Autowired
    private FollowUpService followUpService;
    @ApiOperation("新增临时随访记录(返回ID)")
    @RequestMapping(value = "/addFollowup", produces = "application/json;charset=UTF-8", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    public String addFollowup(@ApiParam(name = "doctor", value = "医生代码", defaultValue = "443a196ef8744536a531260eb26c05d7")
                                  @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,
                              @ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "续方CODE")
                              @RequestParam(value = "prescriptioncode", required = false) String prescriptioncode) {
        try {
            String response = followUpService.addFollowup(doctor, patient, date, followupType, followupClass, followupManagerStatus,plandate,prescriptioncode);
            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
    @ObserverRequired
    public String saveFollowupProjectData(@ApiParam(name = "followup", value = "随访项目对象")
                                          @RequestParam(value = "followup", required = true)String followup ) {
        try {
            JSONArray array = JSONArray.parseArray(followup);
//            followUpService.saveFollowupProjectData(id, followupProject, followupProjectData);
            //修改为通过ES查询---2017.11.01--huangwenjie
            for (int i =0;i<array.size();i++){
                String id = array.getJSONObject(i).getString("id");
                String followupProject = array.getJSONObject(i).getString("followupProject");
                String followupProjectData = array.getJSONObject(i).getString("followupProjectData");
                followUpService.esSaveFollowupProjectData(id, followupProject, followupProjectData);
            }
            return write(200, "保存随访项目数据成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存随访项目数据失败!" + e.getMessage());
        }
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

@ -52,7 +52,7 @@ rehabilitation:
  url: http://localhost:10055/svr-wlyy-rehabilitation/
#集美客服配置
customerService:
  url: http://localhost:8180/
  url: http://localhost:8082/
#小程序
applets: