소스 검색

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

zd_123 7 년 전
부모
커밋
c50e8f5985
51개의 변경된 파일1554개의 추가작업 그리고 394개의 파일을 삭제
  1. 0 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/QuestionnaireController.java
  2. 0 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/ScreenResultController.java
  3. 76 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerQuestionnaireController.java
  4. 36 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerScreenResultController.java
  5. 82 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/customer/CustomerSynergyManageController.java
  6. 52 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/doctor/DoctorQuestionnaireController.java
  7. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyTemplateQuestion.java
  8. 96 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderCustomerLog.java
  9. 10 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkorderDO.java
  10. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkordeExecutorDO.java
  11. 2 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyQuestionResultDao.java
  12. 0 26
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyTemplateQuestionDao.java
  13. 29 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyTemplateQuestionsDao.java
  14. 9 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkOrderDao.java
  15. 14 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderExecutorDao.java
  16. 18 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/synergy/ManageSynergyWorkorderServicerDao.java
  17. 9 10
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyTemplateQuestionService.java
  18. 4 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyTemplateService.java
  19. 182 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/QuestionnaireManageService.java
  20. 35 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/ScreenResultManageService.java
  21. 288 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/synergy/SynergyManageService.java
  22. 40 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/HttpClientUtil.java
  23. 6 1
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  24. 1 1
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/device_create_js.jsp
  25. 3 2
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/WlyySignApplication.java
  26. 2 11
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/controller/FamilyLianqianController.java
  27. 2 3
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/FamilyDao.java
  28. 2 4
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/entity/FamilyLianQian.java
  29. 2 13
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/FamilyLianQianService.java
  30. 1 2
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/activemq/HealthArtListener.java
  31. 14 14
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  32. 14 14
      patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml
  33. 10 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyQuestionResultDao.java
  34. 1 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyTemplatesDao.java
  35. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java
  36. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java
  37. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  38. 209 178
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/survey/SurveyScreenResultService.java
  39. 13 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  40. 148 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/survey/ManagerQuestionnaireService.java
  41. 13 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java
  42. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java
  43. 15 46
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java
  44. 22 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/DoctorSurveyScreenResultController.java
  45. 50 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/survey/ManagerQuestionnaireController.java
  46. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java
  47. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java
  48. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinOpenIdUtils.java
  49. 3 0
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  50. 3 1
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  51. 19 19
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml

+ 0 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/QuestionnaireController.java

@ -1,4 +0,0 @@
package com.yihu.wlyy.controller.common.customer;
public class QuestionnaireController {
}

+ 0 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/customer/ScreenResultController.java

@ -1,4 +0,0 @@
package com.yihu.wlyy.controller.common.customer;
public class ScreenResultController {
}

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

@ -0,0 +1,76 @@
package com.yihu.wlyy.controller.synergy.customer;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.service.synergy.QuestionnaireManageService;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * 客服端问卷调查
 * Created by Humingfen on 2018/9/29.
 */
@Controller
@RequestMapping(value = "/customer/question")
@Api(description = "客服端-接收问卷协同服务")
public class CustomerQuestionnaireController extends BaseController {
    @Autowired
    private QuestionnaireManageService questionnaireService;
    @RequestMapping(value = "saveAnswer", method = RequestMethod.POST)
    @ApiOperation(value = "保存用户答案")
    public String saveAnswer( @ApiParam(value = "问卷题目及选项")@RequestParam String jsonData,
                              @ApiParam(value = "客服code")@RequestParam(value = "customerCode")String customerCode,
                              @ApiParam(value = "居民code")@RequestParam(value = "patientCode")String patientCode,
                              @ApiParam(value = "问卷标签")@RequestParam(value = "labelType")Integer labelType,
                              @ApiParam(value = "筛查入口(labelType=5时要填),0是第一次筛查 1是再次评估", defaultValue = "1")@RequestParam(value = "isAgain")int isAgain,
                              @ApiParam(value = "来源(1医生发放 2居民自我评估)")@RequestParam(value = "source")int source,
                              @ApiParam(value = "协同工单服务对象表code")@RequestParam(value = "source")String serviceCode) {
        try {
            return  write(200, "保存成功!", "data", questionnaireService.saveResultAndAnswer(patientCode, labelType, customerCode, isAgain, source,jsonData, serviceCode));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "保存失败!");
        }
    }
    @RequestMapping(value = "getAnswers", method = RequestMethod.GET)
    @ApiOperation(value = "查看调查统计结果")
    public String getAnswers(@ApiParam(value = "问卷code") @RequestParam String templateCode) {
        try {
            return write(200, "查询成功!", "data", questionnaireService.getAnswers(templateCode));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "getResult", method = RequestMethod.GET)
    @ApiOperation(value = "查看客服对居民调查问卷结果")
    public String getResult(@ApiParam(value = "调查结果code") @RequestParam String questionResultCode) {
        try {
            return write(200, "查询成功!", "data", questionnaireService.getReuslt(questionResultCode));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
    @RequestMapping(value = "getQuestionnaireDetail", method = RequestMethod.GET)
    @ApiOperation(value = "查看调查问卷内容")
    public String getQuestionnaireDetail(@ApiParam(value = "调查问卷code") @RequestParam String surveyCode) {
        try {
            return write(200, "查询成功!", "data", questionnaireService.getQuestionnaireDetail(surveyCode));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
}

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

@ -0,0 +1,36 @@
package com.yihu.wlyy.controller.synergy.customer;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.service.synergy.ScreenResultManageService;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * 客服端疾病筛查
 * Created by Humingfen on 2018/9/29.
 */
@Controller
@RequestMapping(value = "/customer/screen")
@Api(description = "客服端-接收问卷协同服务")
public class CustomerScreenResultController extends BaseController {
    @Autowired
    private ScreenResultManageService screenResultService;
    @RequestMapping(value = "getScreenResultDetail", method = RequestMethod.GET)
    @ApiOperation(value = "查看筛查结果记录详情")
    public String getScreenResultDetail(@ApiParam(value = "筛查结果唯一code")@RequestParam(value = "code") String code) {
        try {
            return write(200, "获取成功!", "data", screenResultService.getScreenResultDetail(code));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "获取失败!");
        }
    }
}

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

@ -1,9 +1,91 @@
package com.yihu.wlyy.controller.synergy.customer;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.service.synergy.SynergyManageService;
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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
/**
 * Created by 刘文彬 on 2018/9/27.
 */
public class CustomerSynergyManageController extends BaseController {
    @Autowired
    private SynergyManageService synergyManageService;
    @RequestMapping(value = "/getWorkOrderInfo", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "获取协同服务工单信息")
    public String addCallRecord(@ApiParam(name="workorderCode",value="协同服务工单code")
                                @RequestParam(required = true)String workorderCode,
                                @ApiParam(name="role",value="1医生,2客服管理员,3普通客服")
                                @RequestParam(required = true)Integer role){
        try {
            return write(200,"保存成功","data", synergyManageService.getWorkOrderInfo(workorderCode, role));
        }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)
                                @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、超时,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 = "page", value = "第几页,从1开始", required = true)
                                @RequestParam(value = "page", required = false,defaultValue = "1")Integer page,
                                @ApiParam(name = "pageSize", value = "每页分页大小", required = true)
                                @RequestParam(value = "pageSize", required = false,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);
            return write(200, "获取成功", "data", result);
        } catch (Exception e) {
            error(e);
            return error(-1, "请求失败");
        }
    }
}

+ 52 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/synergy/doctor/DoctorQuestionnaireController.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.controller.synergy.doctor;
import com.fasterxml.jackson.core.type.TypeReference;
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.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.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
 * 管理端问卷调查
 * Created by humingfen on 2018/9/27.
 */
@Controller
@RequestMapping(value = "/doctor")
@Api(description = "医生端-派发协同服务")
public class DoctorQuestionnaireController extends BaseController {
    @Autowired
    ObjectMapper objectMapper;
    @Autowired
    private QuestionnaireManageService questionnaireService;
    @Autowired
    private SynergyManageService synergyManageService;
    @RequestMapping(value = "/createWorkOrder", method = {RequestMethod.GET, RequestMethod.POST})
    @ApiOperation(value = "派发协同服务")
    public String addCallRecord(@ApiParam(name="jsonData",value="协同服务json字符串")
                                    @RequestParam(required = true)String jsonData,
                                @ApiParam(name="patientInfo",value="居民信息json字符串")
                                    @RequestParam(required = true)String patientInfo){
        try {
            ManageSynergyWorkorderDO manageSynergyWorkorderDO = objectMapper.readValue(jsonData, ManageSynergyWorkorderDO.class);
            List<ManageSynergyWorkorderServicerDO>  manageSynergyWorkorderServicerDOS = objectMapper.readValue(patientInfo, new TypeReference<List<ManageSynergyWorkorderServicerDO>>(){});
            return write(200,"保存成功","data",questionnaireService.createWorkOrder(manageSynergyWorkorderDO, manageSynergyWorkorderServicerDOS));
        }catch (Exception e){
            error(e);
            return error(-1,"保存失败");
        }
    }
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/survey/SurveyTemplateQuestion.java

@ -14,7 +14,7 @@ import java.util.Date;
 */
@Entity
@Table(name = "wlyy_survey_template_questions")
public class SurveyTemplateQuestion extends IdEntity{
public class SurveyTemplateQuestions extends IdEntity{
    private static final long serialVersionUID = 1L;
    private String code;
    private String templateCode;//模板code

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

@ -0,0 +1,96 @@
package com.yihu.wlyy.entity.synergy;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by 刘文彬 on 2018/9/29.
 * 客服操作工单日志
 */
@Entity
@Table(name = "manage_synergy_workorder_customer_log")
public class ManageSynergyWorkorderCustomerLog extends IdEntity {
    private String code;
    private Date createTime;//添加时间
    private String workorderCode;//系统服务工单code
    private String servicePatientCode;//协同服务对象code
    private String createUserCode;//创建人(客服)code
    private String createUserName;//创建人(客服)名称
    private String callCode;//通话记录code
    private Integer status;//状态(0、未完成,1、处理完成)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "create_time")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "workorder_code")
    public String getWorkorderCode() {
        return workorderCode;
    }
    public void setWorkorderCode(String workorderCode) {
        this.workorderCode = workorderCode;
    }
    @Column(name = "service_patient_code")
    public String getServicePatientCode() {
        return servicePatientCode;
    }
    public void setServicePatientCode(String servicePatientCode) {
        this.servicePatientCode = servicePatientCode;
    }
    @Column(name = "create_user_code")
    public String getCreateUserCode() {
        return createUserCode;
    }
    public void setCreateUserCode(String createUserCode) {
        this.createUserCode = createUserCode;
    }
    @Column(name = "create_user_name")
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Column(name = "call_code")
    public String getCallCode() {
        return callCode;
    }
    public void setCallCode(String callCode) {
        this.callCode = callCode;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

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

@ -27,6 +27,7 @@ public class ManageSynergyWorkorderDO extends IdEntity {
    private Integer del;//逻辑删除(0、有效,1、删除)
    private String content;//服务内容
    private String relationCode;//根据type关联业务code
    private String relationCodeName;//关联业务名称
    private String returnedRemark;//退回操作备注说明
    private String dealResultRemark;//处理结果
    private String dealResultAccessory;//处理结果附件
@ -150,6 +151,15 @@ public class ManageSynergyWorkorderDO extends IdEntity {
        this.relationCode = relationCode;
    }
    @Column(name = "relation_code_name")
    public String getRelationCodeName() {
        return relationCodeName;
    }
    public void setRelationCodeName(String relationCodeName) {
        this.relationCodeName = relationCodeName;
    }
    @Column(name = "returned_remark")
    public String getReturnedRemark() {
        return returnedRemark;

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/synergy/ManageSynergyWorkordeExecutorDO.java

@ -12,7 +12,7 @@ import javax.persistence.Table;
 */
@Entity
@Table(name = "manage_synergy_workorder_executor")
public class ManageSynergyWorkordeExecutorDO extends IdEntity {
public class ManageSynergyWorkorderExecutorDO extends IdEntity {
    private String code;
    private String workorderCode;//协同服务工单code
    private Integer executorType;//执行人类型(1、负责人(客服),2、协作着(客服),3、医生)

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

@ -8,4 +8,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * Created by humingfen on 2018/9/27.
 */
public interface SurveyQuestionResultDao extends PagingAndSortingRepository<SurveyQuestionResult, Long>, JpaSpecificationExecutor<SurveyQuestionResult> {
    SurveyQuestionResult findByCode(String code);
}

+ 0 - 26
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyTemplateQuestionDao.java

@ -1,26 +0,0 @@
package com.yihu.wlyy.repository.survey;
import com.yihu.wlyy.entity.survey.SurveyTemplateQuestion;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2017/3/7.
 */
public interface SurveyTemplateQuestionDao extends PagingAndSortingRepository<SurveyTemplateQuestion,Long>,JpaSpecificationExecutor<SurveyTemplateQuestion> {
    @Query("update SurveyTemplateQuestion set del = 0 where templateCode=?1 and del = 1")
    @Modifying
    void updateDelByTemplateCode(String templateCode);
    @Modifying
    void deleteByTemplateCode(String templateCode);
    List<SurveyTemplateQuestion> findByTemplateCodeAndDel(String templateCode,String del);
    SurveyTemplateQuestion findByCode(String code);
}

+ 29 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/survey/SurveyTemplateQuestionsDao.java

@ -0,0 +1,29 @@
package com.yihu.wlyy.repository.survey;
import com.yihu.wlyy.entity.survey.SurveyTemplateQuestions;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2017/3/7.
 */
public interface SurveyTemplateQuestionsDao extends PagingAndSortingRepository<SurveyTemplateQuestions,Long>,JpaSpecificationExecutor<SurveyTemplateQuestions> {
    @Query("update SurveyTemplateQuestions set del = 0 where templateCode=?1 and del = 1")
    @Modifying
    void updateDelByTemplateCode(String templateCode);
    @Modifying
    void deleteByTemplateCode(String templateCode);
    List<SurveyTemplateQuestions> findByTemplateCodeAndDel(String templateCode, String del);
    SurveyTemplateQuestions findByCode(String code);
    @Query("select q from SurveyTemplateQuestions q where q.templateCode = ?1")
    List<SurveyTemplateQuestions> findByTemplateCode(String templateCode);
}

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

@ -0,0 +1,9 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import org.springframework.data.repository.PagingAndSortingRepository;
public interface ManageSynergyWorkOrderDao extends PagingAndSortingRepository<ManageSynergyWorkorderDO, Long> {
    ManageSynergyWorkorderDO findByCode(String workorderCode);
}

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

@ -0,0 +1,14 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderExecutorDO;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface ManageSynergyWorkorderExecutorDao extends PagingAndSortingRepository<ManageSynergyWorkorderExecutorDO, Long> {
    @Query("select e from ManageSynergyWorkorderExecutorDO e where e.workorderCode = ?1 and e.executorType = ?2 and e.del=1")
    List<ManageSynergyWorkorderExecutorDO> findByWorkorderCode(String workorderCode, Integer executorType);
}

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

@ -0,0 +1,18 @@
package com.yihu.wlyy.repository.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;
public interface ManageSynergyWorkorderServicerDao extends PagingAndSortingRepository<ManageSynergyWorkorderServicerDO, Long> {
    @Query(" select count(1) from ManageSynergyWorkorderServicerDO s where s.workorderCode=?1 and s.status=?2 ")
    Integer findByWorkorderCodeCount(String workorderCode,Integer status);
    @Transactional
    @Modifying
    @Query("update ManageSynergyWorkorderServicerDO s set s.relationCode = ?2 where s.code = ?1")
    void updateRelationCodeByCode(String serviceCode, String questionResultCode);
}

+ 9 - 10
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyTemplateQuestionService.java

@ -1,12 +1,11 @@
package com.yihu.wlyy.service.manager.survey;
import com.yihu.wlyy.entity.survey.SurveyTemplateQuestion;
import com.yihu.wlyy.repository.survey.SurveyTemplateQuestionDao;
import com.yihu.wlyy.entity.survey.SurveyTemplateQuestions;
import com.yihu.wlyy.repository.survey.SurveyTemplateQuestionsDao;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
@ -14,9 +13,9 @@ import java.util.List;
 * Created by ysj on 2017/3/3.
 */
@Service
public class SurveyTemplateQuestionService extends BaseJpaService<SurveyTemplateQuestion,Long> {
public class SurveyTemplateQuestionService extends BaseJpaService<SurveyTemplateQuestions,Long> {
    @Autowired
    SurveyTemplateQuestionDao surveyTemplateQuestionDao;
    SurveyTemplateQuestionsDao surveyTemplateQuestionDao;
    /**
     * 根据模板code删除数据
@ -36,19 +35,19 @@ public class SurveyTemplateQuestionService extends BaseJpaService<SurveyTemplate
     * @param templateCode
     * @return
     */
    public List<SurveyTemplateQuestion> findByTemplateCode(String templateCode){
    public List<SurveyTemplateQuestions> findByTemplateCode(String templateCode){
        return surveyTemplateQuestionDao.findByTemplateCodeAndDel(templateCode,"1");
    }
    public void save(List<SurveyTemplateQuestion> surveyTemplateQuestions){
    public void save(List<SurveyTemplateQuestions> surveyTemplateQuestions){
        surveyTemplateQuestionDao.save(surveyTemplateQuestions);
    }
    public SurveyTemplateQuestion save(SurveyTemplateQuestion surveyTemplateQuestion){
       return surveyTemplateQuestionDao.save(surveyTemplateQuestion);
    public SurveyTemplateQuestions save(SurveyTemplateQuestions surveyTemplateQuestions){
       return surveyTemplateQuestionDao.save(surveyTemplateQuestions);
    }
    public SurveyTemplateQuestion findByCode(String code){
    public SurveyTemplateQuestions findByCode(String code){
        return  surveyTemplateQuestionDao.findByCode(code);
    }
}

+ 4 - 4
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/survey/SurveyTemplateService.java

@ -5,7 +5,7 @@ import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.survey.SurveyLabelInfo;
import com.yihu.wlyy.entity.survey.SurveyTemplate;
import com.yihu.wlyy.entity.survey.SurveyTemplateOption;
import com.yihu.wlyy.entity.survey.SurveyTemplateQuestion;
import com.yihu.wlyy.entity.survey.SurveyTemplateQuestions;
import com.yihu.wlyy.repository.SystemDictDao;
import com.yihu.wlyy.repository.survey.SurveyTemplateDao;
import com.yihu.wlyy.service.manager.user.UserService;
@ -57,7 +57,7 @@ public class SurveyTemplateService extends BaseJpaService<SurveyTemplate,Long> {
    public SurveyTemplate saveOrUpdate(String jsonData,String loginUserId){
        JSONArray array = new JSONArray(jsonData);
        List<SurveyTemplate> surveyTemplates = new ArrayList<>();
        List<SurveyTemplateQuestion> surveyTemplateQuestions = new ArrayList<>();
        List<SurveyTemplateQuestions> surveyTemplateQuestions = new ArrayList<>();
        List<SurveyTemplateOption> surveyTemplateOptions = new ArrayList<>();
        List<SurveyLabelInfo> surveyLabelInfos = new ArrayList<>();
        SurveyTemplate surveyTemplate = null;
@ -87,7 +87,7 @@ public class SurveyTemplateService extends BaseJpaService<SurveyTemplate,Long> {
            if(!jsonObject.isNull("questions")){
                JSONArray questionsArray = (JSONArray)jsonObject.get("questions");
                for(Object questionObj:questionsArray){
                    SurveyTemplateQuestion surveyTemplateQuestion = new SurveyTemplateQuestion();
                    SurveyTemplateQuestions surveyTemplateQuestion = new SurveyTemplateQuestions();
                    JSONObject questionJson = (JSONObject)questionObj;
                    clazzReflect.formatToClazz(surveyTemplateQuestion,questionJson);
                    surveyTemplateQuestion.setCreateTime(new Date());
@ -206,7 +206,7 @@ public class SurveyTemplateService extends BaseJpaService<SurveyTemplate,Long> {
        if(surveyTemplate==null) throw new  RuntimeException("模板不存在!");
        JSONObject surveyTemplateJson = new JSONObject(surveyTemplate);
        if(loadQuestion==1l){
            List<SurveyTemplateQuestion> surveyTemplateQuestions = this.surveyTemplateQuestionService.findByTemplateCode(surveyTemplate.getCode());
            List<SurveyTemplateQuestions> surveyTemplateQuestions = this.surveyTemplateQuestionService.findByTemplateCode(surveyTemplate.getCode());
            JSONArray questions = new JSONArray(surveyTemplateQuestions);

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

@ -0,0 +1,182 @@
package com.yihu.wlyy.service.synergy;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.survey.SurveyQuestionResult;
import com.yihu.wlyy.entity.survey.SurveyTemplateQuestions;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderServicerDO;
import com.yihu.wlyy.repository.survey.SurveyQuestionResultDao;
import com.yihu.wlyy.repository.survey.SurveyTemplateQuestionsDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by humingfen on 2018/09/27.
 */
@Service
public class QuestionnaireManageService extends BaseJpaService {
    @Value("${wlyy.url}")
    private String wlyyUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private ManageSynergyWorkOrderDao workOrderDao;
    @Autowired
    private ManageSynergyWorkorderServicerDao workorderServicerDao;
    @Autowired
    private SurveyTemplateQuestionsDao templateQuestionDao;
    @Autowired
    private SurveyQuestionResultDao questionResultDao;
    /**
     * 创建协同服务
     * @param workorderDO
     * @param workorderServicerDOS
     * @return
     */
    public boolean createWorkOrder(ManageSynergyWorkorderDO workorderDO, List<ManageSynergyWorkorderServicerDO> workorderServicerDOS) {
        String servicer = null;
        int size = workorderServicerDOS.size();
        int len = 0;
        if(size > 5){
            len = 5;
        }else {
            len = size;
        }
        //获取服务对象最多五个人
        for(int i = 0; i < len; i++){
            servicer += workorderServicerDOS.get(i).getServicePatientName() + ",";
        }
        servicer = servicer.substring(0, servicer.length()-1);
        //保存协同服务工单
        workorderDO.setCode(getCode());
        workorderDO.setStatus(1);
        workorderDO.setCreateTime(new Date());
        workorderDO.setDel(1);
        workorderDO.setServicerCount(size);
        workorderDO.setServicerKey(servicer);
        workOrderDao.save(workorderDO);
        //保存协同服务工单的服务对象
        for(ManageSynergyWorkorderServicerDO servicerDO : workorderServicerDOS){
            servicerDO.setCode(getCode());
            servicerDO.setWorkorderType(workorderDO.getType());
            servicerDO.setWorkorderCode(workorderDO.getCode());
            servicerDO.setStatus(1);
            servicerDO.setCreateTime(new Date());
            workorderServicerDao.save(servicerDO);
        }
        return true;
    }
    /**
     * 保存问卷结果
     * @param patientCode
     * @param labelType
     * @param customerCode
     * @param isAgain
     * @param source
     * @param jsonData
     * @param serviceCode
     */
    public String saveResultAndAnswer(String patientCode, Integer labelType, String customerCode, int isAgain, int source, String jsonData, String serviceCode) {
        String url = wlyyUrl + "doctor/questionnaire/saveResultAndAnswer";
        String response = "";
        Map<String, Object> params = new HashMap<>();
        params.put("labelType", labelType);
        params.put("patientCode", patientCode);
        params.put("jsonData", jsonData);
        params.put("customerCode", customerCode);
        params.put("source", source);
        try {
            response = httpClientUtil.post(url, params);
        } catch (Exception e) {
            e.printStackTrace();
        }
        JSONObject object = JSONObject.parseObject(response);
        String questionResultCode = object.getString("data");
        if(StringUtils.isNotBlank(questionResultCode)) {
            workorderServicerDao.updateRelationCodeByCode(serviceCode, questionResultCode);
        }
        return questionResultCode;
    }
    /**
     * 查看调查问卷统计结果
     * @param templateCode
     * @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();
        }
        return JSONObject.parseObject(response);
    }
    /**
     * 根据问卷结果code查看居民填写问卷详情
     * @param code
     * @return
     */
    public JSONObject getReuslt(String code){
        JSONObject json = new JSONObject();
        //查找问卷结果信息
        SurveyQuestionResult questionResult = questionResultDao.findByCode(code);
        String patient = questionResult.getPatientCode();
        String templateCode = questionResult.getTemplateCode();
        //获取模板问题
        List<SurveyTemplateQuestions> questionList = templateQuestionDao.findByTemplateCode(templateCode);
        //查找选项和答案
        Map<String, Object> answerMap = new HashMap<>();
        String sql = "SELECT soa.*, sto.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code = ? AND soa.patient=? AND soa.survey_code=?";
        List<Map<String, Object>> optionAnswersList = jdbcTemplate.queryForList(sql, new Object[]{code, patient, templateCode});
        for (SurveyTemplateQuestions templateQuestion : questionList) {
            Map<String, Object> map = new HashMap<>();
            map.put("question", templateQuestion);
            String qusCode = templateQuestion.getCode();
            for (Map<String, Object> option : optionAnswersList) {
                if (option.get("question_code").equals(qusCode)) {
                    map.put("option", option);
                }
            }
            answerMap.put(templateQuestion.getSort() + "", map);
        }
        json.put("answer", answerMap);
        return json;
    }
    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();
        }
        return JSONObject.parseObject(response);
    }
}

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

@ -0,0 +1,35 @@
package com.yihu.wlyy.service.synergy;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.util.HttpClientUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by humingfen on 2018/09/29.
 */
@Service
public class ScreenResultManageService {
    @Value("${wlyy.url}")
    private String wlyyUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    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();
        }
        return JSONObject.parseObject(response);
    }
}

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

@ -1,7 +1,295 @@
package com.yihu.wlyy.service.synergy;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderDO;
import com.yihu.wlyy.entity.synergy.ManageSynergyWorkorderExecutorDO;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkOrderDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderExecutorDao;
import com.yihu.wlyy.repository.synergy.ManageSynergyWorkorderServicerDao;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * Created by 刘文彬 on 2018/9/27.
 */
@Service
@Transactional
public class SynergyManageService {
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Autowired
    private ManageSynergyWorkOrderDao workOrderDao;
    @Autowired
    private ManageSynergyWorkorderServicerDao workorderServicerDao;
    @Autowired
    private ManageSynergyWorkorderExecutorDao workorderExecutorDao;
    /**
     * 根据服务编码获取工单
     * @param workorderCode
     * @return
     */
    public ManageSynergyWorkorderDO findWorkOrderByCode(String workorderCode) {
        return workOrderDao.findByCode(workorderCode);
    }
    /**
     * 我接收到的任务
     * @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 1、医生,2、客服,3、客服管理员
     * @param isAcceptTask 1、我接收到的任务,2、我派发的任务,3、待接收(客服管理员),4、已接收(客服管理员)
     * @return
     * @throws Exception
     */
    public List<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 servicerTable = "";
        String whereSql = "";
        if(userType==3){//客服管理员
            whereSql +=" and w.create_user_type=1 ";//创建人为医生
            if(isAcceptTask==3){//待接收
                whereSql +=" and w.status =1 ";
            }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+"%' ";
        }
        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);
        List<Map<String,Object>> resultList = new ArrayList<>();
        for(Map<String,Object> one : resultWorkorderList){
            Map<String,Object> map = new HashMap<>();
            map.put("workorderCode",one.get("code"));//服务编码
            Integer workorderTypeR = (Integer) one.get("type");
            String workorderTypeName = "";
            map.put("type",workorderTypeR);//服务类型
            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;
            }
            map.put("typeName",workorderTypeName);//服务类型名称
            map.put("serviceTime", DateUtil.dateToStr((Date)one.get("service_time"),"yyyy-MM-dd HH:mm"));//服务时间
            map.put("priority",one.get("priority"));//工单优先级
            map.put("priorityName",((Integer)one.get("priority"))==1?"加急":"普通");
            Integer overTime = isServiceOverTime((Date)one.get("service_time"));
            map.put("overTime",overTime);//是否超时
            String[] servicer = (one.get("servicer_key")+"").split(",");
            map.put("servicer",servicer[0]);//服务对象
            map.put("servicerCount",one.get("servicer_count"));//服务对象人数
            Integer statusR = (Integer) one.get("status");
            map.put("status",statusR);//工单状态
            String statusName="";
            switch (statusR){
                case 0:statusName="草稿";break;
                case 1:statusName="未接受";break;
                case 2:statusName="处理中";break;
                case 3:statusName="处理完成";break;
                case 4:statusName="退回";break;
            }
            map.put("statusName",statusName);
            List<ManageSynergyWorkorderExecutorDO> managerList = workorderExecutorDao.findByWorkorderCode(one.get("code")+"",1);
            String managerName = managerList.size()>0?managerList.get(0).getExecutorName():"";
            map.put("managerName",managerName);//负责人的名称
            Integer finishedServicerCount = workorderServicerDao.findByWorkorderCodeCount(one.get("code")+"",3);
            map.put("finishedServicerCount",finishedServicerCount);//服务完成人数
            resultList.add(map);
        }
        return resultList;
    }
    /**
     * 获取服务编码
     * @return
     */
    public synchronized String getWorkorderNo(){
        String orderNo = "" ;
        String trandNo = String.valueOf((Math.random() * 9 + 1) * 1000000);
        String sdf = new SimpleDateFormat("yyyyMMddHHMMSS").format(new Date());
        orderNo = trandNo.toString().substring(0, 4);
        orderNo = sdf + orderNo ;
        return orderNo ;
    }
    /**
     * 获取超时级别
     * @param serviceTime
     * @return
     */
    public Integer isServiceOverTime(Date serviceTime){
        //当前时间 > 服务时间+4小时(已超时)3
        //服务时间+4小时 > 当前时间 > 服务时间(红色超时)2
        //服务时间 HH:mm:59()> 当前时间 > 服务时间 HH:mm:00(黄色超时)1
        //服务时间 HH:mm:00 > 当前时间 (正常)0
        Integer serviceStatus = null;
        String serviceTimeStart = DateUtil.dateToStr(serviceTime,"yyyy-MM-dd HH:mm")+":00";
        String serviceTimeEnd = DateUtil.dateToStr(serviceTime,"yyyy-MM-dd HH:mm")+":59";
        Long serviceTimeStartLong = DateUtil.strToDate(serviceTimeStart,"yyyy-MM-dd HH:mm:ss").getTime();
        Long serviceTimeEndLong = DateUtil.strToDate(serviceTimeEnd,"yyyy-MM-dd HH:mm:ss").getTime();
        Long serviceTimeAfter4Long = serviceTimeEndLong+4*60*60*1000;
        Long currentTime = new Date().getTime();
        if(currentTime<serviceTimeStartLong){//正常
            serviceStatus=0;
        }else if(currentTime>=serviceTimeStartLong&&currentTime<=serviceTimeEndLong){//黄色超时
            serviceStatus=1;
        }else if(currentTime>serviceTimeEndLong&&currentTime<=serviceTimeAfter4Long){//红色超时
            serviceStatus=2;
        }else if(currentTime>serviceTimeAfter4Long){//已超时
            serviceStatus=3;
        }
        return serviceStatus;
    }
    //获取系统服务详情
    public Map<String, Object> getWorkOrderInfo(String workorderCode, Integer role) {
        Map<String, Object> map = new HashMap<>();
        ManageSynergyWorkorderDO workorderDO = workOrderDao.findByCode(workorderCode);
        //存入协同服务工单信息
        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("title", workorderDO.getRelationCodeName());
        map.put("remark", workorderDO.getRemark());
        map.put("servicerKey", workorderDO.getServicerKey());
        map.put("servicerCount", workorderDO.getServicerCount());
        map.put("createTime", workorderDO.getCreateTime());
        map.put("createUserName", workorderDO.getCreateUserName());
        //判断是否超时
        Date now = new Date();
        long hour = (now.getTime() - workorderDO.getServiceTime().getTime())/60*60*1000;
        if(hour <= 4){
            map.put("delay", "red");
        }else if(hour <= 24){
            map.put("delay", "yellow");
        }
        //根据角色显示对应工单状态
        if(workorderDO.getCreateUserType() == 1 && role == 2){
            map.put("status", "待接收");
        }else if(workorderDO.getCreateUserType() == 2 && role == 1){
            map.put("status", "未接收");
        }
        //获取负责人信息
        if(role == 3){
            List<ManageSynergyWorkorderExecutorDO> managerList = workorderExecutorDao.findByWorkorderCode(workorderCode,1);
            List<ManageSynergyWorkorderExecutorDO> collaboratorList = workorderExecutorDao.findByWorkorderCode(workorderCode,2);
            String manager = managerList.size()>0 ? managerList.get(0).getExecutorName() : "";
            String collaborator = "";
            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());
            map.put("accessory", workorderDO.getDealResultAccessory());
        }
        return map;
    }
}

+ 40 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/util/HttpClientUtil.java

@ -110,6 +110,46 @@ public class HttpClientUtil {
		}
	}
	/**
	 * http调用方法
	 *
	 * @param url
	 * @param params
	 * @return
	 * @throws Exception
	 */
	public  String post(String url, Map<String, Object> params) throws Exception {
		CloseableHttpClient httpclient = HttpClients.createDefault();
		RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(30000).setConnectTimeout(10000).build();//设置请求和传输超时时间
		try {
			HttpPost httpPost = new HttpPost(url);
			httpPost.setConfig(requestConfig);
			if (params != null && params.size() > 0) {
				List<NameValuePair> valuePairs = new ArrayList<NameValuePair>(params.size());
				for (Map.Entry<String, Object> entry : params.entrySet()) {
					NameValuePair nameValuePair = new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue()));
					valuePairs.add(nameValuePair);
				}
				UrlEncodedFormEntity formEntity = new UrlEncodedFormEntity(valuePairs, "UTF-8");
				httpPost.setEntity(formEntity);
			}
			CloseableHttpResponse resp = httpclient.execute(httpPost);
			try {
				HttpEntity entity = resp.getEntity();
				String respContent = EntityUtils.toString(entity, "UTF-8").trim();
				return respContent;
			} finally {
				resp.close();
			}
		} catch (Exception e) {
			e.printStackTrace();
			return null;
		} finally {
			httpclient.close();
		}
	}
	/**
	 * 发送get请求
	 * @param url 请求地址

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

@ -104,7 +104,9 @@ reservation:
healthbank:
  url: http://172.19.103.33:8660/svr-wlyy-health-bank/svr-health-bank/
#  url: http://192.168.131.133:10051/svr-health-bank/
#i健康1.0接口
wlyy:
  url: http://localhost:8080/wlyy/
wechat:
  appId: wxd03f859efdf0873d
  appSecret: 2935b54b53a957d9516c920a544f2537
@ -212,6 +214,9 @@ reservation:
#健康活动url
healthbank:
  url: http://172.19.103.33:8660/svr-wlyy-health-bank/svr-health-bank/
#i健康1.0接口
wlyy:
  url: http://localhost:8080/wlyy/
wechat:
  appId: wx1f129f7b51701428
  appSecret: 988f005d8309ed1795939e0f042431fb

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

@ -117,7 +117,7 @@
						//厂家代码
						values.manufacturerId = $("#sel_manufacturer").ligerComboBox("getValue");
						values.deviceModel = $("#inp_deviceModel").ligerComboBox("getValue");
						if (!validator.validate()) {
							return;
						}

+ 3 - 2
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/WlyySignApplication.java

@ -1,5 +1,6 @@
package com.yihu.wlyy.sign;
import com.yihu.wlyy.sign.common.thread.*;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
@ -14,7 +15,7 @@ public class WlyySignApplication extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        /*//加载机构签约修改
        //加载机构签约修改
        Thread loadThread = new Thread(new LoadThread());
        loadThread.start();
@ -47,7 +48,7 @@ public class WlyySignApplication extends SpringBootServletInitializer {
        //加载续签数据
        Thread loadRenewSignThread = new Thread(new LoadRenewSignThread());
        loadRenewSignThread.start();*/
        loadRenewSignThread.start();
        return application.sources(WlyySignApplication.class);
    }

+ 2 - 11
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/controller/FamilyLianqianController.java

@ -2,18 +2,9 @@ package com.yihu.wlyy.sign.controller;/**
 * Created by nature of king on 2018/8/10.
 */
import com.yihu.wlyy.sign.common.model.Result;
import com.yihu.wlyy.sign.service.FamilyLianQianService;
import com.zoe.phip.ssp.sdk.ApiException;
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.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
@ -25,7 +16,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
@Api(description = "家庭成员信息")
public class FamilyLianqianController {
    @Autowired
    /*@Autowired
    private FamilyLianQianService service;
    @RequestMapping(value = "select",method = RequestMethod.POST)
@ -51,5 +42,5 @@ public class FamilyLianqianController {
                return Result.error(ex.getMessage());
            }
        }
    }
    }*/
}

+ 2 - 3
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/FamilyDao.java

@ -4,7 +4,6 @@ package com.yihu.wlyy.sign.dao;/**
import com.yihu.wlyy.sign.entity.FamilyLianQian;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@ -13,6 +12,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 * @desc 家庭成员
 **/
public interface FamilyDao extends PagingAndSortingRepository<FamilyLianQian, Long>, JpaSpecificationExecutor<FamilyLianQian> {
    @Query("from FamilyLianQian a  where a.idcard = ?1 ")
    FamilyLianQian findByIdCard(String idcard);
   /* @Query("from FamilyLianQian a  where a.idcard = ?1 ")
    FamilyLianQian findByIdCard(String idcard);*/
}

+ 2 - 4
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/entity/FamilyLianQian.java

@ -4,8 +4,6 @@ package com.yihu.wlyy.sign.entity;/**
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
@ -18,7 +16,7 @@ import java.io.Serializable;
@Entity
@Table(name = "tbl_lianqian_family")
public class FamilyLianQian extends IdEntity implements Serializable {
    @Column(name = "address_code")
   /* @Column(name = "address_code")
    private String addressCode;//地址
    @Column(name = "relaholder")
    private String relaholder;//关系
@ -198,5 +196,5 @@ public class FamilyLianQian extends IdEntity implements Serializable {
    public void setAddress(String address) {
        this.address = address;
    }
    }*/
}

+ 2 - 13
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/FamilyLianQianService.java

@ -2,20 +2,9 @@ package com.yihu.wlyy.sign.service;/**
 * Created by nature of king on 2018/8/9.
 */
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.sign.dao.*;
import com.yihu.wlyy.sign.entity.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
@ -26,7 +15,7 @@ import java.util.List;
@Service
@Transactional
public class FamilyLianQianService {
    private Logger logger = LoggerFactory.getLogger(FamilyLianQianService.class);
   /* private Logger logger = LoggerFactory.getLogger(FamilyLianQianService.class);
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
@ -146,5 +135,5 @@ public class FamilyLianQianService {
            e.printStackTrace();
            return null;
        }
    }
    }*/
}

+ 1 - 2
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/activemq/HealthArtListener.java

@ -2,7 +2,6 @@ package com.yihu.wlyy.activemq;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.task.PushMsgTask;
@ -23,7 +22,6 @@ import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;
import javax.jms.TextMessage;
import java.util.*;
/**
 * Created by chenweida on 2017/9/9.
@ -169,6 +167,7 @@ public class HealthArtListener implements MessageListener {
                        json.put("toUser", member.getCode());
                        json.remove("first");
                        json.put("first", weiXinOpenIdUtils.getTitleMes(patient, j.isNull("relation") ? 1 : j.getInt("relation"), patient.getName()));
//                        json.put("represented","");
                        if (StringUtils.isNotBlank(member.getOpenid())) {
                            pushMsgTask.putWxMsg(weiXinAccessTokenUtils.getAccessToken(), 9, member.getOpenid(), patient.getName(), json);
                        }

+ 14 - 14
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -291,9 +291,9 @@ public class PushMsgTask {
            String temp_id = "";
            if (type == 3) {
                if (json.has("isPublic") && json.getInt("isPublic") == 1) {
                    temp.setUrl(url + "jbsq/html/public-consult-detail.html?openid=" + openid + "&code=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                    temp.setUrl(url + "jbsq/html/public-consult-detail.html?openid=" + openid + "&code=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                } else {
                    temp.setUrl(url + "yszx/html/consulting-doctor.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                    temp.setUrl(url + "yszx/html/consulting-doctor.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                }
                temp_id = template_consult_notice;
                temp.setTemplate_id(temp_id);
@ -328,10 +328,10 @@ public class PushMsgTask {
                } else {
                    if (json.has("agent") && ("1".equals(json.getString("agent")))) {
//                        发送给授权代理人
                        temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + json.getString("represented") + "&signCode=" + json.getString("signCode"));
                        temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):"") + "&signCode=" + json.getString("signCode"));
                    } else if (json.has("agent") && ("0".equals(json.getString("agent")))) {
//                        发送给自己
                        temp.setUrl(url + "qygl/html/pay_flow.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + json.getString("represented") + "&signCode=" + json.getString("signCode"));
                        temp.setUrl(url + "qygl/html/pay_flow.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):"") + "&signCode=" + json.getString("signCode"));
                    }
                }
                temp.setTouser(openid);
@ -354,7 +354,7 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("content"));
                m.put("keyword4", keyword4);
            } else if (type == 4) {
                temp.setUrl(url + "yszd/html/guidance-detail.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&id=" + String.valueOf(json.get("id")) + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "yszd/html/guidance-detail.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&id=" + String.valueOf(json.get("id")) + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp_id = template_health_notice;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -378,7 +378,7 @@ public class PushMsgTask {
                keyword5.setValue(json.getString("content"));
                m.put("keyword5", keyword5);
            } else if (type == 5) {
                temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp_id = template_termination;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -398,7 +398,7 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("date"));
                m.put("keyword4", keyword4);
            } else if (type == 6) {
                temp.setUrl(url + "wdyy/html/detail-appointment.html?openid=" + openid + "&orgCode=" + json.get("orgCode") + "&id=" + json.getString("id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "wdyy/html/detail-appointment.html?openid=" + openid + "&orgCode=" + json.get("orgCode") + "&id=" + json.getString("id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp_id = template_appoint_success;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -418,7 +418,7 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("date"));
                m.put("planstarttime", keyword4);
            } else if (type == 7) {
                temp.setUrl(url + "wdyy/html/my-appointment.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "wdyy/html/my-appointment.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp_id = template_appoint_failed;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -458,11 +458,11 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("content"));
                m.put("remark", keyword4);
            } else if (type == 9) {
                temp.setUrl(url + "jkjy/html/article.html?openid=" + openid + "&dataId=" + json.getString("article") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "jkjy/html/article.html?openid=" + openid + "&dataId=" + json.getString("article") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                //如果是ArticleUrl不为空,那就说明是外部系统推送文章(如:集美宣教)
                Boolean articleUrl = json.has("newArricleFlag") ? json.getBoolean("newArricleFlag") : false;
                if(articleUrl.booleanValue()){
                    temp.setUrl(url + "jkjy/html/article2.html?openid=" + openid + "&dataId=" + json.getString("article") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                    temp.setUrl(url + "jkjy/html/article2.html?openid=" + openid + "&dataId=" + json.getString("article") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                }
                temp_id = template_healthy_article;
                temp.setTemplate_id(temp_id);
@ -490,7 +490,7 @@ public class PushMsgTask {
                if (json.has("url")) {
                    temp.setUrl(url + json.getString("url"));
                }else {
                    temp.setUrl(url + "qygl/html/signing-doctors.html?openid=" + openid + "&state=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                    temp.setUrl(url + "qygl/html/signing-doctors.html?openid=" + openid + "&state=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                }
                temp.setTemplate_id(template_doctor_change);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -511,7 +511,7 @@ public class PushMsgTask {
                if (json.has("url")) {
                    temp.setUrl(url + json.getString("url"));
                } else {
                    String xinurl = url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented");
                    String xinurl = url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):"");
//                temp.setUrl(url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name);
                    temp.setUrl(xinurl);
                }
@ -594,7 +594,7 @@ public class PushMsgTask {
                keyword1.setValue(json.getString("keyword1"));
                m.put("keyword1", keyword1);
            } else if (type == 16) {
                temp.setUrl(url + "xuqian/html/information.html?openid=" + openid + "&changeDoctor=" + 1 + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "xuqian/html/information.html?openid=" + openid + "&changeDoctor=" + 1 + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -605,7 +605,7 @@ public class PushMsgTask {
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
            } else if (type == 17) {
                temp.setUrl(url + "yszx/html/manyidu.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "yszx/html/manyidu.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");

+ 14 - 14
patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml

@ -43,35 +43,35 @@ wechat:
  accId: gh_ffd64560fb21
  message:
   ##医生追加建议提醒 --签约邀请
   doctor_invitel_template: uXdBJVbrhKG-WLaCG4s8C4SXSr2kknQ94vKFt-3rIiA
   doctor_invitel_template: YA8VtN_JYORLHrbEhQkNoRjlpJXIGVGnb4_OhVq4OBs
   #咨询回复
   template_consult_notice: dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18
   template_consult_notice: oGFfTWPEYvwwfmcIK1hquZ4-cVXdNomV3bCMLfj97Jc
   #签约成功
   template_sign_success: VYGj8OUKj6FH4i4_nZS2UAHurJxQHx-7_OBPILIdB8s
   template_sign_success: SQBxvSvX_JA5xez11MIFvxzamV0w3i3DeU8yB8O1lUY
   #签约失败
   template_sign_failed: m221Jrkm0UUY00ExTCpQNTB8t_1U_V4LR9Bg8BgH9-o
   template_sign_failed: sFyAMmdJjzeqjzQvRcjIajDtUZx3pBhTGxRyj-A-uuQ
   #健康指导提醒
   template_health_notice: 5Nts8lA_at9Cd1JuTK-qDxx95lchpcmUfPTEwYDgXYQ
   template_health_notice: hOu3swzpEi07jY5ojEB1vd6M6pflksn3pgfAQ6R6NT0
   #解约提醒
   template_termination:  qZm1NwSueAsbHaOf9DrnLoSj0X5gZuh9W7aDYzLWNds
   template_termination:  K1rUqmIJ6RvQviit1r_ZyPCRmjdZyFZVe0_zKeVWu30
   #预约成功
   template_appoint_success:  vU5x2tGyk1zUngBrEqMfnFqqMa6M8J98w8k5MCSUYM
   template_appoint_success:  3JNK8saVZvWUTWZ1veamC_pAEJPOLorj0sRKv1_V6-Y
   #预约取消
   template_appoint_failed:  r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
   template_appoint_failed:  iq9An2I_WgUC2BnouzSpL0bDflAO6B_AQw5TjTrYKgU
   #缴费提醒
   template_expenses_remind:  pZby4Mz3H5angmjGTuvXzo9lwlaVfEiqORwI8soI-5E
   template_expenses_remind:  umuDSVNrUy_yYPmENRg1BHszW3sDpFtCCPEdobXxAmQ
   #健康教育
   template_healthy_article: aO_qqk5nAXaGXhsikPVLNelqzwlrp1LTPfIQ1qRMpxo
   template_healthy_article: dH8ML1nDOruIAUnA9dv19w4HF95p_xiHcmpq-Noutxo
   #医生变更
   template_doctor_change:  V5h0F84t972kUzQvWy8qYrgdaYGJVj10pFeFVl19Nb8
   template_doctor_change:  RMKwJ-PLHP-uBwjJlHDgPaVFZhjuXvhSO7V8Dwh7vPc
   #问卷调查
   template_doctor_survey:  OqQXrb-e43_TJpq_70_K_y6vYJgY5mpjFYY4c5RWFP4
   #审核结果通知
   template_doctor_audit:  lCtOgJgL1tBJbAytqN7cn-FgCH_Usg99FENEy2TrC08
   template_doctor_audit:  kyrkan8cWQ22J_NC01e8yGwsn75MeUtfgdCrZKkwSLQ
   #服务结果通知
   template_doctor_service:  i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw
   template_doctor_service:  2hEhp2bLfmM-7Goc6rJ3EE4a4wvuhyndKufruYTk6A0
   #设备测量提醒
   template_device_measure_notice: bzwLOFFPSe2vq74IljvVIPmvjP-C4ebEUAFORyq-2dY
   template_device_measure_notice: 5bzC6o_9zlL24loYnF7hFLskuRzCyX8v48KfWmYOL3c
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/

+ 10 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyQuestionResultDao.java

@ -0,0 +1,10 @@
package com.yihu.wlyy.repository.doctor;
import com.yihu.wlyy.entity.doctor.survey.SurveyQuestionResult;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by humingfen on 2018/9/29.
 */
public interface SurveyQuestionResultDao extends PagingAndSortingRepository<SurveyQuestionResult, Long> {
}

+ 1 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SurveyTemplatesDao.java

@ -6,7 +6,6 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
/**
@ -25,7 +24,7 @@ public interface SurveyTemplatesDao extends PagingAndSortingRepository<SurveyTem
    @Query("select count(t.id)  from SurveyTemplates t where t.title like ?1 ")
    int distinctLikeTitle(String title);
    @Query("select  t from SurveyTemplates t where t.code = ?1 ")
    @Query("select  t from SurveyTemplates t where t.code = ?1 and t.del = 1")
    SurveyTemplates findById(String code);
    @Modifying

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/DoctorInfoService.java

@ -1322,13 +1322,14 @@ public class DoctorInfoService extends BaseService {
                        json.remove("toUser");
                        json.put("toUser", member.getCode());
                        json.remove("first");
                        json.put("first", weiXinOpenIdUtils.getTitleMes(p, (int) json.get("relation"), p.getName()) + p.getName() + ",您好!您签约团队的全科医生已变更,您的新全科医生信息如下:");
                        json.put("first", weiXinOpenIdUtils.getTitleMes(p, 0, p.getName()) + p.getName() + ",您好!您签约团队的全科医生已变更,您的新全科医生信息如下:");
                        pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), p.getName(), json);
                    }
                }
            }
        }catch (Exception e){
            logger.info(e.getMessage());
            e.printStackTrace();
        }
    }

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/family/FamilyMemberService.java

@ -357,6 +357,7 @@ public class FamilyMemberService extends BaseService {
            result.put("name", StringUtils.isEmpty(p.getName()) ? "" : p.getName());
            result.put("code", StringUtils.isEmpty(p.getCode()) ? "" : p.getCode());
            result.put("photo", StringUtils.isEmpty(p.getPhoto()) ? "" : p.getPhoto());
            result.put("sex",p.getSex());
        }
        return result;
@ -952,7 +953,7 @@ public class FamilyMemberService extends BaseService {
    }
    public String getFamilyMesListSql(String code) {
        StringBuffer sql = new StringBuffer("SELECT t.*,p.idcard,p.mobile,p.photo FROM wlyy_patient_family_temp t,wlyy_patient p WHERE t.patient = p.code AND t.dealer ='" + code+"'");
        StringBuffer sql = new StringBuffer("SELECT t.*,p.idcard,p.mobile,p.photo,p.sex FROM wlyy_patient_family_temp t,wlyy_patient p WHERE t.patient = p.code AND t.dealer ='" + code+"'");
        return sql.toString();
    }

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java

@ -2635,15 +2635,17 @@ public class FamilyContractService extends BaseService {
                //发送代理人
                JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
                if (jsonArray != null && jsonArray.length() > 0) {
                    String msgFirst = (String)msg.get("first");
                    for (int i = 0; i < jsonArray.length(); i++) {
                        JSONObject j = jsonArray.getJSONObject(i);
                        Patient member = (Patient) j.get("member");
                        JSONObject data = msg;
                        data.remove("toUser");
                        data.put("toUser", member.getCode());
                        String first = (String) data.get("first");
                        String first = msgFirst;
                        data.remove("first");
                        data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName()));
                        data.put("first", weiXinOpenIdUtils.getTitleMes(p, j.getInt("relation"), p.getName())+first);
//                        data.put("represented","");
                        pushMsgTask.putWxMsg(accessTokenUtils.getAccessToken(), 10, member.getOpenid(), p.getName(), data);
                    }
                }

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

@ -3,18 +3,17 @@ package com.yihu.wlyy.service.app.survey;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.survey.*;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.survey.ManagerQuestionnaireService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.collections.map.HashedMap;
@ -25,6 +24,7 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -39,6 +39,9 @@ import java.util.*;
@Service
@Transactional
public class SurveyScreenResultService extends BaseService {
    @Value("${customerService.url}")
    private String customerUrl;
    @Autowired
    SurveyStatisticsDao surveyStatisticsDao;
    @Autowired
@ -52,28 +55,18 @@ public class SurveyScreenResultService extends BaseService {
    @Autowired
    private SurveyTemplateResultDao surveyTemplateResultDao;
    @Autowired
    private SurveyTemplateAdviceDao surveyTemplateAdviceDao;
    @Autowired
    private SurveyTemplateQuestionsDao surveyTemplateQuestionsDao;
    @Autowired
    private SurveyOptionAnswersDao surveyOptionAnswersDao;
    @Autowired
    private DoctorDao doctorDao;
    @Autowired
    private SurveyAdviceDao surveyAdviceDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private ManagerQuestionnaireService managerQuestionnaireService;
    @Autowired
    private SurveyDao surveyDao;
    @Autowired
    private SurveyQuestionsDao surveyQuestionsDao;
    @Autowired
    private SurveyLabelInfoDao surveyLabelInfoDao;
    @Autowired
    private SurveyQuestionsOptionsDao surveyQuestionsOptionsDao;
    @Autowired
    private SurveyUserDao surveyUserDao;
    @Autowired
    private SurveyFilterDao surveyFilterDao;
@ -82,12 +75,6 @@ public class SurveyScreenResultService extends BaseService {
    @Autowired
    private SurveyQuestionnaireDao surveyQuestionnaireDao;
    @Autowired
    private SurveyTemplateOptionsDao surveyTemplateOptionsDao;
    @Autowired
    private SurveyAnswersDao surveyAnswersDao;
    @Autowired
    private SystemDictDao systemDictDao;
    @Autowired
    private SurveyDimensionDao surveyDimensionDao;
    @Autowired
    private SurveyDimensionDetailDao surveyDimensionDetailDao;
@ -99,6 +86,8 @@ public class SurveyScreenResultService extends BaseService {
    private PushMsgTask pushMsgTask;
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private DoctorService doctorService;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
@ -106,6 +95,7 @@ public class SurveyScreenResultService extends BaseService {
    /**
     * 筛查记录结果列表
     *
     * @param pageNo
     * @param pageSize
     * @param doctor
@ -116,78 +106,80 @@ public class SurveyScreenResultService extends BaseService {
     * @return
     * @throws Exception
     */
    public Map<String,Object> getResultList(int pageNo, int pageSize,String doctor,String diseaseType,String dealType,String isDanger,String patientName) throws Exception {
        int start = (pageNo-1)*pageSize;
        String sql = "SELECT ssr.* FROM wlyy_survey_screen_result ssr WHERE 1=1 AND ssr.over = 1 and ssr.source=1 and ssr.doctor='"+doctor+"'";
    public Map<String, Object> getResultList(int pageNo, int pageSize, String doctor, String diseaseType, String dealType, String isDanger, String patientName) throws Exception {
        int start = (pageNo - 1) * pageSize;
        String sql = "SELECT ssr.* FROM wlyy_survey_screen_result ssr WHERE 1=1 AND ssr.over = 1 and ssr.source=1 and ssr.doctor='" + doctor + "'";
        //String countSql = "SELECT count(*) num FROM wlyy_survey_screen_result ssr WHERE 1=1 AND ssr.over = 1 and ssr.doctor='"+doctor+"'";
        if (StringUtils.isNotEmpty(isDanger)){
            sql += " AND ssr.is_danger= "+isDanger;
        if (StringUtils.isNotEmpty(isDanger)) {
            sql += " AND ssr.is_danger= " + isDanger;
        }
        if (StringUtils.isNotEmpty(diseaseType)){
            sql += " AND ssr.disease="+diseaseType;
        if (StringUtils.isNotEmpty(diseaseType)) {
            sql += " AND ssr.disease=" + diseaseType;
        }
        if (StringUtils.isNotEmpty(patientName)){
            sql += " AND ssr.patient_name like '%"+patientName+"%'";
        if (StringUtils.isNotEmpty(patientName)) {
            sql += " AND ssr.patient_name like '%" + patientName + "%'";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("1",dealType)){
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("1", dealType)) {
            //已预约
            sql += " AND ssr.is_order = 1";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("2",dealType)){
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("2", dealType)) {
            //已跟踪
            sql += " AND ssr.following= 1";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("3",dealType)){
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("3", dealType)) {
            //已接诊
            sql += " AND ssr.is_order = 2";
        }
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("4",dealType)){
        if (StringUtils.isNotEmpty(dealType) && StringUtils.equals("4", dealType)) {
            //待处理
            sql +=" AND ssr.is_order = 0 AND ssr.following= 0";
            sql += " AND ssr.is_order = 0 AND ssr.following= 0";
        }
        List<Map<String,Object>> maps = jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
        sql += " order by ssr.czrq desc limit "+start+","+pageSize;
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        Map<String,Object> map = new HashedMap();
        map.put("num",maps.size());
        map.put("data",surveyScreenResultList);
        sql += " order by ssr.czrq desc limit " + start + "," + pageSize;
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        Map<String, Object> map = new HashedMap();
        map.put("num", maps.size());
        map.put("data", surveyScreenResultList);
        return map;
    }
    /**
     * 筛查模板列表
     *
     * @param pageNo
     * @param pageSize
     * @param labelType
     * @return
     */
    public List<SurveyTemplates> getScreenList(int pageNo,int pageSize,int labelType,String title){
        int start = (pageNo-1)*pageSize;
    public List<SurveyTemplates> getScreenList(int pageNo, int pageSize, int labelType, String title) {
        int start = (pageNo - 1) * pageSize;
        String sql = "SELECT st.* FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_label_info sli ON st.`code`= sli.relation_code" +
                " WHERE st.del = 1 and sli.label="+labelType+"";
        if (StringUtils.isNotEmpty(title)){
            sql += " and st.title like '%"+title+"%'";
                " WHERE st.del = 1 and sli.label=" + labelType + "";
        if (StringUtils.isNotEmpty(title)) {
            sql += " and st.title like '%" + title + "%'";
        }
        sql += " order by st.create_time desc limit "+start+","+pageSize;
        List<SurveyTemplates> surveyTemplatesList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyTemplates.class));
        sql += " order by st.create_time desc limit " + start + "," + pageSize;
        List<SurveyTemplates> surveyTemplatesList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(SurveyTemplates.class));
        return surveyTemplatesList;
    }
    /**
     * 保存筛查结果
     *
     * @param patientCode
     * @param doctor
     * @param source
     * @param jsonData
     */
    public String saveScreenResultAndAnswer(String patientCode,String doctor,int isAgain,int source, JSONObject jsonData)throws Exception{
    public String saveScreenResultAndAnswer(String patientCode, String doctor, int isAgain, int source, JSONObject jsonData) throws Exception {
        System.out.println("********保存筛查结果--jsonData********* " + jsonData);
        String surveyCode = jsonData.get("surveyCode").toString();
        SurveyTemplates surveyTemplates = surveyTemplatesDao.findById(surveyCode);
        Patient patient = patientDao.findByCode(patientCode);
        SurveyScreenResult surveyScreenResult =  new SurveyScreenResult();
        SurveyScreenResult surveyScreenResult = new SurveyScreenResult();
        //解析json保存各种答案--获取一维数组
        JSONArray questions = jsonData.getJSONArray("questions");
        int totalScore = 0;
@ -222,12 +214,12 @@ public class SurveyScreenResultService extends BaseService {
            }
        }
        //查询该筛查的结果设置
        SurveyTemplateResult surveyTemplateResult = surveyTemplateResultDao.getByTemplateCodeAndLowScoreAndHighScore(surveyCode,totalScore);
        SurveyTemplateResult surveyTemplateResult = surveyTemplateResultDao.getByTemplateCodeAndLowScoreAndHighScore(surveyCode, totalScore);
        //更新上一条数据为不可再次评估
        List<SurveyScreenResult> surveyScreenResultList = surveyScreenResultDao.findNewOneByTemplateCode(surveyCode,patientCode);
        List<SurveyScreenResult> surveyScreenResultList = surveyScreenResultDao.findNewOneByTemplateCode(surveyCode, patientCode);
        String lastCode = "";
        String originCode = "";
        if (surveyScreenResultList!=null && surveyScreenResultList.size()>0){
        if (surveyScreenResultList != null && surveyScreenResultList.size() > 0) {
            lastCode = surveyScreenResultList.get(0).getCode();
            originCode = surveyScreenResultList.get(0).getOriginCode();
            surveyScreenResultDao.updateNoAgain(lastCode);
@ -236,20 +228,20 @@ public class SurveyScreenResultService extends BaseService {
        surveyScreenResult.setCode(code);
        surveyScreenResult.setSource(source);
        //是来自再次评估
        if (isAgain==1){
        if (isAgain == 1) {
            surveyScreenResult.setParentCode(lastCode);
            surveyScreenResult.setOriginCode(originCode);
        }else {
        } else {
            //来自第一次筛查评分
            surveyScreenResult.setOriginCode(code);
        }
        if (surveyTemplates!=null){
        if (surveyTemplates != null) {
            surveyScreenResult.setTemplateCode(surveyTemplates.getCode());
            surveyScreenResult.setTemplateTitle(surveyTemplates.getTitle());
            surveyScreenResult.setDisease(surveyTemplates.getDiseaseType());
        }
        //来自医生发放和自我评估不一样来源
        if (source==1){
        if (source == 1) {
            surveyScreenResult.setDoctor(doctor);
        }/*else {
            SignFamily signFamily = signFamilyDao.findByPatient(patientCode);
@ -262,7 +254,7 @@ public class SurveyScreenResultService extends BaseService {
        }*/
        surveyScreenResult.setPatientCode(patientCode);
        if (patient!=null){
        if (patient != null) {
            surveyScreenResult.setPatientName(patient.getName());
            surveyScreenResult.setOpenId(patient.getOpenid());
        }
@ -273,38 +265,38 @@ public class SurveyScreenResultService extends BaseService {
        surveyScreenResult.setIsAgain(1);
        surveyScreenResult.setIsEducate(0);
        surveyScreenResult.setScreenResultScore(totalScore);
        if (surveyTemplateResult!=null){
        if (surveyTemplateResult != null) {
            surveyScreenResult.setScreenResultCode(surveyTemplateResult.getCode());
            surveyScreenResult.setIsDanger(surveyTemplateResult.getWarning());
            surveyScreenResult.setScreenResult(surveyTemplateResult.getResult());
        }
        surveyScreenResultDao.save(surveyScreenResult);
        managerQuestionnaireService.saveAnswer(patientCode,code,jsonData);
        managerQuestionnaireService.saveAnswer(patientCode, code, jsonData);
        return code;
    }
    public JSONObject getScreenResultDetail(String code)throws Exception{
    public JSONObject getScreenResultDetail(String code) throws Exception {
        JSONObject json = new JSONObject();
        //登记信息
        String infoSql = "SELECT ssr.*,p.idcard FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient p ON ssr.patient_code=p.code where ssr.code ='"+code+"'";
        Map<String,Object> infoMap = jdbcTemplate.queryForMap(infoSql);
        if (infoMap==null || infoMap.size()==0){
            json.put(code,-1);
            json.put("message","没有改筛查结果!");
        String infoSql = "SELECT ssr.*,p.idcard FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient p ON ssr.patient_code=p.code where ssr.code ='" + code + "'";
        Map<String, Object> infoMap = jdbcTemplate.queryForMap(infoSql);
        if (infoMap == null || infoMap.size() == 0) {
            json.put(code, -1);
            json.put("message", "没有改筛查结果!");
            return json;
        }
        String idcard = String.valueOf(infoMap.get("idcard"));
        infoMap.put("sex",IdCardUtil.getSexForIdcard_new(idcard));
        infoMap.put("age",IdCardUtil.getAgeForIdcard(idcard));
        infoMap.put("sex", IdCardUtil.getSexForIdcard_new(idcard));
        infoMap.put("age", IdCardUtil.getAgeForIdcard(idcard));
        String templateCode = String.valueOf(infoMap.get("template_code"));
        String doctorCode = String.valueOf(infoMap.get("doctor"));
        String patientCode = String.valueOf(infoMap.get("patient_code"));
        Doctor doctor = doctorDao.findByCode(doctorCode);
        if (doctor!=null){
            infoMap.put("level",doctor.getLevel());
            infoMap.put("doctorName",doctor.getName());
        if (doctor != null) {
            infoMap.put("level", doctor.getLevel());
            infoMap.put("doctorName", doctor.getName());
        }
        json.put("info",infoMap);
        json.put("info", infoMap);
        /*String healthSql ="SELECT value1,value2 FROM device.wlyy_patient_health_index WHERE user='"+patientCode+"' AND type=3 ORDER BY record_date DESC LIMIT 1";
        List<Map<String,Object>> healthMapList = jdbcTemplate.queryForList(healthSql);
        if (healthMapList!=null && healthMapList.size()>0){
@ -313,170 +305,171 @@ public class SurveyScreenResultService extends BaseService {
        //题目和答案
        List<SurveyTemplateQuestions> questionList = surveyTemplateQuestionsDao.findById(templateCode);
        Map<String,Object> answerMap = new HashMap<>();
        Map<String, Object> answerMap = new HashMap<>();
        String sql = "SELECT soa.*,sto.score,sto.content FROM wlyy_survey_option_answers soa LEFT JOIN wlyy_survey_template_options sto ON soa.options_code= sto.code WHERE soa.screen_result_code=? AND soa.patient=? AND soa.survey_code=?";
        List<Map<String,Object>> optionAnswersList = jdbcTemplate.queryForList(sql,new Object[]{code,patientCode,templateCode});
        for (SurveyTemplateQuestions surveyTemplateQuestions : questionList){
            Map<String,Object> map = new HashMap<>();
            map.put("question",surveyTemplateQuestions);
        List<Map<String, Object>> optionAnswersList = jdbcTemplate.queryForList(sql, new Object[]{code, patientCode, templateCode});
        for (SurveyTemplateQuestions surveyTemplateQuestions : questionList) {
            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);
            for (Map<String, Object> option : optionAnswersList) {
                if (option.get("question_code").equals(qusCode)) {
                    map.put("option", option);
                }
            }
            answerMap.put(surveyTemplateQuestions.getSort()+"",map);
            answerMap.put(surveyTemplateQuestions.getSort() + "", map);
        }
        json.put("answer",answerMap);
        json.put("answer", answerMap);
        //结果
        String reultSql ="SELECT ssr.screen_result_score,ssr.screen_result,str.advice FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_survey_template_result str ON ssr.screen_result_code = str.code WHERE ssr.code='"+code+"'";
        Map<String,Object> resultMap = jdbcTemplate.queryForMap(reultSql);
        String reultSql = "SELECT ssr.screen_result_score,ssr.screen_result,str.advice FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_survey_template_result str ON ssr.screen_result_code = str.code WHERE ssr.code='" + code + "'";
        Map<String, Object> resultMap = jdbcTemplate.queryForMap(reultSql);
        int following = Integer.parseInt(String.valueOf(infoMap.get("following")));
        int order = Integer.parseInt(String.valueOf(infoMap.get("is_order")));
        if (order>0){
        if (order > 0) {
            //已转诊
            String doctorSql ="SELECT pr.doctor_name FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient_reservation pr ON ssr.reservation_code= pr.`code` where ssr.`code`='"+code+"'";
            List<String> list= jdbcTemplate.queryForList(doctorSql,String.class);
            if (list!=null && list.size()>0){
                json.put("specialDoctorName",list.get(0));
            String doctorSql = "SELECT pr.doctor_name FROM wlyy_survey_screen_result ssr LEFT JOIN wlyy_patient_reservation pr ON ssr.reservation_code= pr.`code` where ssr.`code`='" + code + "'";
            List<String> list = jdbcTemplate.queryForList(doctorSql, String.class);
            if (list != null && list.size() > 0) {
                json.put("specialDoctorName", list.get(0));
            }
        }else if (following==1){
        } else if (following == 1) {
            String adviceCodes = String.valueOf(infoMap.get("advice_code"));
            List<SurveyAdvice> surveyAdviceList = new ArrayList<>();
            if (StringUtils.isNotEmpty(adviceCodes)){
            if (StringUtils.isNotEmpty(adviceCodes)) {
                String[] advicesStr = adviceCodes.split(",");
                for (String adviceCode : advicesStr){
                for (String adviceCode : advicesStr) {
                    surveyAdviceList.add(surveyAdviceDao.getByCode(adviceCode));
                }
            }
            resultMap.put("doctorAdvice",surveyAdviceList);
            resultMap.put("doctorOtherAdvice",infoMap.get("other_advice"));
            resultMap.put("doctorAdvice", surveyAdviceList);
            resultMap.put("doctorOtherAdvice", infoMap.get("other_advice"));
        }
        json.put("result",resultMap);
        json.put("result", resultMap);
        return json;
    }
    public List<Map<String,Object>> getTemplateAdviceList(String templateCode){
        String sql ="SELECT st.template_code,sa.code adviceCode,sa.advice FROM wlyy_survey_template_advice st LEFT JOIN wlyy_survey_advice sa ON st.advice_code=sa.`code` WHERE st.template_code='"+templateCode+"'";
    public List<Map<String, Object>> getTemplateAdviceList(String templateCode) {
        String sql = "SELECT st.template_code,sa.code adviceCode,sa.advice FROM wlyy_survey_template_advice st LEFT JOIN wlyy_survey_advice sa ON st.advice_code=sa.`code` WHERE st.template_code='" + templateCode + "'";
        return jdbcTemplate.queryForList(sql);
    }
    public void updateAfterFollowing(String code,String adviceCodes,String otherAdvice)throws Exception{
        String sql ="UPDATE wlyy_survey_screen_result SET following=1,advice_code=?";
        if (StringUtils.isNotEmpty(otherAdvice)){
    public void updateAfterFollowing(String code, String adviceCodes, String otherAdvice) throws Exception {
        String sql = "UPDATE wlyy_survey_screen_result SET following=1,advice_code=?";
        if (StringUtils.isNotEmpty(otherAdvice)) {
            sql += " ,other_advice=?";
        }
        sql +=" where code=?";
        if (StringUtils.isNotEmpty(otherAdvice)){
            jdbcTemplate.update(sql,new Object[]{adviceCodes,otherAdvice,code});
        }else {
            jdbcTemplate.update(sql,new Object[]{adviceCodes,code});
        sql += " where code=?";
        if (StringUtils.isNotEmpty(otherAdvice)) {
            jdbcTemplate.update(sql, new Object[]{adviceCodes, otherAdvice, code});
        } else {
            jdbcTemplate.update(sql, new Object[]{adviceCodes, code});
        }
    }
    public void updateColume(String colume,Object value,String code){
        String sql ="UPDATE wlyy_survey_screen_result SET "+colume+"=? where code=?";
        jdbcTemplate.update(sql,new Object[]{value,code});
    public void updateColume(String colume, Object value, String code) {
        String sql = "UPDATE wlyy_survey_screen_result SET " + colume + "=? where code=?";
        jdbcTemplate.update(sql, new Object[]{value, code});
    }
    public Map<String,Object> patientGetList(int pageNo,int pageSize,int labelType,String patientCode){
        Map<String,Object> map = new HashedMap();
        List<SurveyTemplates> templates = getScreenList(pageNo,pageSize,labelType,null);
        List<Map<String,Object>> mapList = new ArrayList<>();
        for (SurveyTemplates surveyTemplates : templates){
            Map<String,Object> sMap = new HashedMap();
            sMap.put("surveyTemplate",surveyTemplates);
            int count =  surveyScreenResultDao.getByPatientCodeAndTemplateCode(patientCode,surveyTemplates.getCode(),2).size();
            sMap.put("myRecordCount",count);
    public Map<String, Object> patientGetList(int pageNo, int pageSize, int labelType, String patientCode) {
        Map<String, Object> map = new HashedMap();
        List<SurveyTemplates> templates = getScreenList(pageNo, pageSize, labelType, null);
        List<Map<String, Object>> mapList = new ArrayList<>();
        for (SurveyTemplates surveyTemplates : templates) {
            Map<String, Object> sMap = new HashedMap();
            sMap.put("surveyTemplate", surveyTemplates);
            int count = surveyScreenResultDao.getByPatientCodeAndTemplateCode(patientCode, surveyTemplates.getCode(), 2).size();
            sMap.put("myRecordCount", count);
            mapList.add(sMap);
        }
        map.put("screenList",mapList);
        map.put("screenList", mapList);
        return map;
    }
    public List<SurveyScreenResult> patientGetResult(String patientCode){
        Map<String,Object> map = new HashedMap();
        String sql = "SELECT a.* FROM (SELECT * FROM wlyy_survey_screen_result WHERE source=2 and patient_code='"+patientCode+"' ORDER BY czrq DESC) a  GROUP BY a.template_code";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
    public List<SurveyScreenResult> patientGetResult(String patientCode) {
        Map<String, Object> map = new HashedMap();
        String sql = "SELECT a.* FROM (SELECT * FROM wlyy_survey_screen_result WHERE source=2 and patient_code='" + patientCode + "' ORDER BY czrq DESC) a  GROUP BY a.template_code";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        return surveyScreenResultList;
    }
    public List<Map<String,Object>> getResultByTemplateCode(int pageNo,int pageSize,String templateCode,String patientCode){
        int start = (pageNo-1)*pageSize;
        String sql ="SELECT st.*,ssr.code screenCode,ssr.screen_result,ssr.screen_result_score,ssr.czrq as screenCzrq,ssr.is_again FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_screen_result ssr ON st.code = ssr.template_code WHERE ssr.source=2 and st.`code`='"+templateCode+"' AND ssr.patient_code='"+patientCode+"' order by ssr.czrq limit ?,?";
        return jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
    public List<Map<String, Object>> getResultByTemplateCode(int pageNo, int pageSize, String templateCode, String patientCode) {
        int start = (pageNo - 1) * pageSize;
        String sql = "SELECT st.*,ssr.code screenCode,ssr.screen_result,ssr.screen_result_score,ssr.czrq as screenCzrq,ssr.is_again FROM wlyy_survey_templates st LEFT JOIN wlyy_survey_screen_result ssr ON st.code = ssr.template_code WHERE ssr.source=2 and st.`code`='" + templateCode + "' AND ssr.patient_code='" + patientCode + "' order by ssr.czrq limit ?,?";
        return jdbcTemplate.queryForList(sql, new Object[]{start, pageSize});
    }
    public Map<String,Object> screenStatics(String doctor){
        Map<String,Object> resultMap = new HashedMap();
        String userSql = "SELECT DISTINCT(template_code) FROM wlyy_survey_screen_result WHERE doctor = '"+doctor+"' and source=1";
        List<String> userList = jdbcTemplate.queryForList(userSql,String.class);
    public Map<String, Object> screenStatics(String doctor) {
        Map<String, Object> resultMap = new HashedMap();
        String userSql = "SELECT DISTINCT(template_code) FROM wlyy_survey_screen_result WHERE doctor = '" + doctor + "' and source=1";
        List<String> userList = jdbcTemplate.queryForList(userSql, String.class);
        //使用筛查表数量
        resultMap.put("useTemplateCount",userList.size());
        String sql = "SELECT * FROM wlyy_survey_screen_result WHERE doctor='"+doctor+"' and source=1";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        resultMap.put("useTemplateCount", userList.size());
        String sql = "SELECT * FROM wlyy_survey_screen_result WHERE doctor='" + doctor + "' and source=1";
        List<SurveyScreenResult> surveyScreenResultList = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(SurveyScreenResult.class));
        //下发问卷数量
        resultMap.put("grantCount",surveyScreenResultList.size());
        resultMap.put("grantCount", surveyScreenResultList.size());
        int overCount = 0;
        int warnCount = 0;
        int followCount = 0;
        int orderCount = 0 ;
        int orderCount = 0;
        int againCount = 0;
        int eduCount = 0;
        for (SurveyScreenResult surveyScreenResult : surveyScreenResultList){
            if (surveyScreenResult.getOver()==1){
        for (SurveyScreenResult surveyScreenResult : surveyScreenResultList) {
            if (surveyScreenResult.getOver() == 1) {
                overCount++;
            }
            if (surveyScreenResult.getIsDanger()==1){
            if (surveyScreenResult.getIsDanger() == 1) {
                warnCount++;
            }
            if (surveyScreenResult.getFollowing()==1){
            if (surveyScreenResult.getFollowing() == 1) {
                followCount++;
            }
            if (surveyScreenResult.getIsOrder()>0){
            if (surveyScreenResult.getIsOrder() > 0) {
                orderCount++;
            }
            if (StringUtils.isNotEmpty(surveyScreenResult.getParentCode())){
            if (StringUtils.isNotEmpty(surveyScreenResult.getParentCode())) {
                againCount++;
            }
            if (surveyScreenResult.getIsEducate()==1){
            if (surveyScreenResult.getIsEducate() == 1) {
                eduCount++;
            }
        }
        //筛查记录
        resultMap.put("overCount",overCount);
        resultMap.put("overCount", overCount);
        //疑似高危
        resultMap.put("dangetCount",warnCount);
        resultMap.put("dangetCount", warnCount);
        //健康跟踪
        resultMap.put("followCount",followCount);
        resultMap.put("followCount", followCount);
        //已跟踪
        resultMap.put("orderCount",orderCount);
        resultMap.put("orderCount", orderCount);
        //再次评估
        resultMap.put("againCount",againCount);
        resultMap.put("againCount", againCount);
        //健康教育
        resultMap.put("eduCount",eduCount);
        return  resultMap;
        resultMap.put("eduCount", eduCount);
        return resultMap;
    }
    public int getAmountByDoctor(String json,String doctorCode) {
        return getCountByDoctor(json,doctorCode).size();
    public int getAmountByDoctor(String json, String doctorCode) {
        return getCountByDoctor(json, doctorCode).size();
    }
    public List<String> getCountByDoctor(String json,String doctorCode) {
    public List<String> getCountByDoctor(String json, String doctorCode) {
//        1.服务 2.健康 3疾病
        JSONObject jsonObject = new JSONObject(json);
        String sql = "";
        String sex = jsonObject.get("sex").toString();
        String str = "SELECT DISTINCT lb.patient FROM wlyy_sign_patient_label_info lb,(SELECT DISTINCT ff.patient FROM wlyy_sign_family_server s, " +
                " (SELECT f.`code`,f.patient FROM wlyy_sign_family f,wlyy_patient p WHERE p.CODE=f.patient and (f.doctor='"+doctorCode+"' OR  f.doctor_health='"+doctorCode+"')";
                " (SELECT f.`code`,f.patient FROM wlyy_sign_family f,wlyy_patient p WHERE p.CODE=f.patient and (f.doctor='" + doctorCode + "' OR  f.doctor_health='" + doctorCode + "')";
        if (!"0".equals(sex)) {
            str += " AND p.sex=  " + sex +
                    " AND f.STATUS>0 AND p.`openid` IS NOT NULL AND p.`openid`!='')ff WHERE ff.CODE=s.sign_code ";
                    " AND f.STATUS>0 AND f.expenses_status = 1 AND p.`openid` IS NOT NULL AND p.`openid`!='')ff WHERE ff.CODE=s.sign_code ";
        } else {
            str += " AND f.STATUS>0 AND p.`openid`IS NOT NULL AND p.`openid`!='')ff WHERE ff.CODE=s.sign_code ";
            str += " AND f.STATUS>0 AND f.expenses_status = 1 AND p.`openid`IS NOT NULL AND p.`openid`!='')ff WHERE ff.CODE=s.sign_code ";
        }
        JSONArray service = jsonObject.getJSONArray("service");
        String ser = "";
@ -532,17 +525,17 @@ public class SurveyScreenResultService extends BaseService {
            dis += " OR ";
        }
        if (StringUtils.isNotEmpty(dis)) {
            disSql= " (lb.label_type =3 AND ( " + dis.substring(0, dis.lastIndexOf("OR")) + " )  )";
            disSql = " (lb.label_type =3 AND ( " + dis.substring(0, dis.lastIndexOf("OR")) + " )  )";
        }
        if (StringUtils.isEmpty(heal) && StringUtils.isEmpty(dis)) {
            sql = str;
        } else if (StringUtils.isEmpty(heal) && StringUtils.isNotEmpty(dis)) {
            sql = str + " AND " +disSql;
            sql = str + " AND " + disSql;
        } else if (StringUtils.isNotEmpty(heal) && StringUtils.isEmpty(dis)) {
            sql = str + " AND " +healSql;
            sql = str + " AND " + healSql;
        } else if (StringUtils.isNotEmpty(heal) && StringUtils.isNotEmpty(dis)) {
            sql = str + " AND ( " + disSql +" OR " +healSql +" ) ";
            sql = str + " AND ( " + disSql + " OR " + healSql + " ) ";
        }
        System.out.println("=====query sql =======>>>>" + sql);
@ -699,7 +692,7 @@ public class SurveyScreenResultService extends BaseService {
        countJson.put("disease", diseaList);
        countJson.put("healthCondition", healthList);
        countJson.put("service", servList);
        List<String> codes = getCountByDoctor(countJson.toString(),doctor);
        List<String> codes = getCountByDoctor(countJson.toString(), doctor);
        int amount = codes.size();
        for (String code : codes) {
//            String code = patient.get("patient").toString();
@ -749,7 +742,7 @@ public class SurveyScreenResultService extends BaseService {
                }
//            });
            }*/
            WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey","scwj");
            WechatTemplateConfig templateConfig = templateConfigDao.findByScene("template_doctor_survey", "scwj");
            String remark = templateConfig.getRemark();
            String keyword1 = templateConfig.getKeyword1();
            String wxTemplateCode = templateCode;
@ -760,20 +753,20 @@ public class SurveyScreenResultService extends BaseService {
                        String name = null;
                        String openId = null;
                        String first = null;
                        String screenCode =null;
                        String screenCode = null;
                        try {
                            screenCode = saveAfterBatchScreen(c,openId,name,doctor,wxTemplateCode);
                            screenCode = saveAfterBatchScreen(c, openId, name, doctor, wxTemplateCode);
                            p = patientDao.findByCode(c);
                            name = p.getName();
                            openId = p.getOpenid();
                            json.put("keyword1", keyword1);
                            json.put("keyword2", sdf.format(new Date()));
                            json.put("survey", wxTemplateCode+"_"+doctor);
                            json.put("survey", wxTemplateCode + "_" + doctor);
                            json.put("toUser", c);
                            json.put("url","jkpg/html/wx-template-message.html?survey="+wxTemplateCode+"&doctor="+doctor+"&toUser="+c+"&toName="+name+"&screenCode="+screenCode);
                            json.put("url", "jkpg/html/wx-template-message.html?survey=" + wxTemplateCode + "&doctor=" + doctor + "&toUser=" + c + "&toName=" + name + "&screenCode=" + screenCode);
//                          String first = name + ",您好!为了给您提供更好的家庭医生健康服务,现有一份问卷需要您填写。";
                            first = templateConfig.getFirst();
                            first = first.replace("key1",(name==null?"":name));
                            first = first.replace("key1", (name == null ? "" : name));
                            json.put("first", first);
                            json.put("remark", remark);
                        } catch (JSONException e) {
@ -785,7 +778,7 @@ public class SurveyScreenResultService extends BaseService {
                            logger.error("json =======>" + json);
//                            PushMsgTask.getInstance().putWxMsg(accessToken, 11, openId, name, json);
                            pushMsgTask.sendWeixinMessage(accessToken, 11, openId, name, json);
                        }else {
                        } else {
                            //发送代理人
                            JSONArray jsonArray = weiXinOpenIdUtils.getAgentOpenId(p.getCode(), p.getOpenid());
                            if (jsonArray != null && jsonArray.length() > 0) {
@ -795,7 +788,7 @@ public class SurveyScreenResultService extends BaseService {
                                    if (StringUtils.isNotBlank(member.getOpenid())) {
                                        json.remove("toUser");
                                        json.put("toUser", member.getCode());
                                        json.put("url","jkpg/html/wx-template-message.html?survey="+wxTemplateCode+"&doctor="+doctor+"&toUser="+member.getCode()+"&toName="+member.getName()+"&screenCode="+screenCode);
                                        json.put("url", "jkpg/html/wx-template-message.html?survey=" + wxTemplateCode + "&doctor=" + doctor + "&toUser=" + member.getCode() + "&toName=" + member.getName() + "&screenCode=" + screenCode);
                                        json.remove("first");
                                        try {
                                            json.put("keyword1", keyword1);
@ -1028,23 +1021,23 @@ public class SurveyScreenResultService extends BaseService {
        return surveyCode;
    }
    public String saveAfterBatchScreen(String patientCode,String openId,String patientName,String doctorCode,String surveyCode){
        SurveyScreenResult surveyScreenResult =  new SurveyScreenResult();
    public String saveAfterBatchScreen(String patientCode, String openId, String patientName, String doctorCode, String surveyCode) {
        SurveyScreenResult surveyScreenResult = new SurveyScreenResult();
        SurveyTemplates surveyTemplates = surveyTemplatesDao.findById(surveyCode);
        Patient patient = patientDao.findByCode(patientCode);
        String code = getCode();
        surveyScreenResult.setCode(code);
        if (surveyTemplates!=null){
        if (surveyTemplates != null) {
            surveyScreenResult.setTemplateCode(surveyTemplates.getCode());
            surveyScreenResult.setTemplateTitle(surveyTemplates.getTitle());
            surveyScreenResult.setDisease(surveyTemplates.getDiseaseType());
        }
        surveyScreenResult.setDoctor(doctorCode);
        surveyScreenResult.setPatientCode(patientCode);
        if (patient!=null){
        if (patient != null) {
            surveyScreenResult.setPatientName(patient.getName());
            surveyScreenResult.setOpenId(patient.getOpenid());
        }else {
        } else {
            surveyScreenResult.setOpenId(openId);
            surveyScreenResult.setPatientName(patientName);
        }
@ -1063,10 +1056,10 @@ public class SurveyScreenResultService extends BaseService {
    }
    public String updateScreenAndSaveAnswer(String patientCode,String screenCode, JSONObject jsonData)throws Exception{
    public String updateScreenAndSaveAnswer(String patientCode, String screenCode, JSONObject jsonData) throws Exception {
        System.out.println("********保存筛查结果--jsonData********* " + jsonData);
        String surveyCode = jsonData.get("surveyCode").toString();
        SurveyScreenResult surveyScreenResult =  surveyScreenResultDao.getSurveyScreenResultByCode(screenCode);
        SurveyScreenResult surveyScreenResult = surveyScreenResultDao.getSurveyScreenResultByCode(screenCode);
        //解析json保存各种答案--获取一维数组
        JSONArray questions = jsonData.getJSONArray("questions");
        int totalScore = 0;
@ -1088,7 +1081,7 @@ public class SurveyScreenResultService extends BaseService {
            }
        }
        //查询该筛查的结果设置
        SurveyTemplateResult surveyTemplateResult = surveyTemplateResultDao.getByTemplateCodeAndLowScoreAndHighScore(surveyCode,totalScore);
        SurveyTemplateResult surveyTemplateResult = surveyTemplateResultDao.getByTemplateCodeAndLowScoreAndHighScore(surveyCode, totalScore);
       /* surveyScreenResult.setOver(1);
        surveyScreenResult.setCzrq(new Date());
        surveyScreenResult.setScreenResultScore(totalScore);
@ -1097,11 +1090,49 @@ public class SurveyScreenResultService extends BaseService {
            surveyScreenResult.setIsDanger(surveyTemplateResult.getWarning());
            surveyScreenResult.setScreenResult(surveyTemplateResult.getResult());
        }*/
       String sql ="UPDATE wlyy_survey_screen_result SET over=1,czrq=?,screen_result_code=?,screen_result=?,screen_result_score=?,is_danger=? WHERE code=?";
       jdbcTemplate.update(sql,new Object[]{new Date(),surveyTemplateResult.getCode(),surveyTemplateResult.getResult(),totalScore,surveyTemplateResult.getWarning(),screenCode});
        String sql = "UPDATE wlyy_survey_screen_result SET over=1,czrq=?,screen_result_code=?,screen_result=?,screen_result_score=?,is_danger=? WHERE code=?";
        jdbcTemplate.update(sql, new Object[]{new Date(), surveyTemplateResult.getCode(), surveyTemplateResult.getResult(), totalScore, surveyTemplateResult.getWarning(), screenCode});
        //surveyScreenResultDao.updateScreenAndSaveAnswer(new Date(),totalScore,surveyTemplateResult.getCode(),surveyTemplateResult.getResult(),surveyTemplateResult.getWarning(),screenCode);
        managerQuestionnaireService.saveAnswer(patientCode,surveyScreenResult.getCode(),jsonData);
        managerQuestionnaireService.saveAnswer(patientCode, surveyScreenResult.getCode(), jsonData);
        return screenCode;
    }
    //获取筛查居民信息
    public List<Map<String, Object>> initPatient(String doctor, String labelType, String serverType, Long teamCode) {
        String sql = "SELECT DISTINCT p.`code` as service_patient_code, p.`name` as service_patient_name, t1.ssc,t1.idcard,t1.mobile,t1.hospital,t1.hospital_name,h.town,h.town_name " +
                "FROM  wlyy_sign_family t1  LEFT JOIN wlyy_patient p on p. CODE = t1.patient   " +
                "LEFT JOIN wlyy_sign_patient_label_info t2 on t2.patient = t1.patient and t2.label_type = " + labelType + " and t2.status=1 " +
                "RIGHT JOIN wlyy_sign_family_server s on s.sign_code = t1.code and s.server_type in (" + serverType + ") " +
                "LEFT JOIN dm_hospital h on t1.hospital = h.`code` " +
                "WHERE ( t1.doctor = ? OR t1.doctor_health = ?) AND t1. STATUS > 0  and t1.expenses_status = 1 AND t1.admin_team_code = ? " +
                "AND p.openid IS NOT NULL AND p.openid <>'' ";
        Object[] args = new Object[]{doctor, doctor, teamCode};
        List<Map<String, Object>> patientInfo = jdbcTemplate.queryForList(sql, args);
        return patientInfo;
    }
    /**
     * 调用集美客服派发问卷协同服务接口
     *
     * @param jsonData
     * @param patientInfo
     * @param doctor
     * @return
     * @throws Exception
     */
    public String createWorkOrder(String jsonData, List<Map<String, Object>> patientInfo, String doctor) throws Exception {
        JSONObject object = new JSONObject(jsonData);
        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("jsonData", object.toString());
        HttpResponse response = null;
        response = HttpUtils.doPost(customerUrl + "wlyy-manage/createWorkOrder", param);
        JSONObject rs = new JSONObject(response.getContent());
        return rs.getString("message");
    }
}

+ 13 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -41,7 +41,6 @@ import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.annotation.Transient;
import org.springframework.data.domain.PageRequest;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -372,6 +371,7 @@ public class JMJkEduArticleService extends BaseService {
        Set<String> openidSet = getOpenid(patientSet);
        List<HealthEduArticleES> healthEduArticleESList = new ArrayList<>();
        List<HealthEduArticleES> healthEduArticleESList2 = new ArrayList<>();
        Doctor doctor = doctorDao.findByCode(sendCode);
        AdminTeam adminTeam =null;
        if(teamId!=null){
@ -404,12 +404,14 @@ public class JMJkEduArticleService extends BaseService {
        }
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"","");
        Date createTime = new Date();
        Set<String> openidSetTemp = new HashSet<>();
        for (String patient : patientSet) {
            one = patientDao.findByCode(patient);
            if(one==null){
                continue;
            }
            HealthEduArticleES healthEduArticleES = new HealthEduArticleES();
            healthEduArticleES.setDoctorCode(doctor.getCode());
            healthEduArticleES.setDoctorName(doctor.getName());
@ -474,7 +476,10 @@ public class JMJkEduArticleService extends BaseService {
            healthEduArticleES.setUserType(1);
            healthEduArticleES.setOpenidSet(openidSet);
            healthEduArticleESList.add(healthEduArticleES);
            if(!openidSetTemp.contains(one.getOpenid())){
                openidSetTemp.add(one.getOpenid());
                healthEduArticleESList2.add(healthEduArticleES);
            }
        }
        if(healthEduArticleESList.size()>0){
@ -489,7 +494,7 @@ public class JMJkEduArticleService extends BaseService {
            elastricSearchSave.save(e, esIndex, esType);
            thirdJkEduArticleService.saveBehavior(articleId,doctor.getCode(),7,patientSet.size());
        }
        return healthEduArticleESList;
        return healthEduArticleESList2;
    }
    public JSONObject pushArticleConfirm(String articleId, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode,String currentUserRole, String currentUserRoleLevel) throws Exception {
        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"","");
@ -516,7 +521,7 @@ public class JMJkEduArticleService extends BaseService {
        //全选的时候前端传0,后台要去数据库再查询一次
        String tableSql = " select p.code from wlyy_sign_family w ,wlyy_admin_team t, dm_hospital h  ";
        String whereSql = " where w.status>0  and w.admin_team_code=t.id and t.org_code=h.code ";
        String whereSql = " where w.status>0 and w.expenses_status=1 and w.admin_team_code=t.id and t.org_code=h.code ";
        //通过登录的角色区域权限 限制所属患者条件
@ -594,7 +599,6 @@ public class JMJkEduArticleService extends BaseService {
            }
            groupPatient = jdbcTemplate.queryForList(sql, String.class);
        }else{
            groupPatient = jdbcTemplate.queryForList(tableSql + whereSql, String.class);
        }
        patientSet.addAll(groupPatient);
@ -1499,7 +1503,10 @@ public class JMJkEduArticleService extends BaseService {
            if(one==null){
                continue;
            }
            openidSet.add(one.getOpenid());
            if(one.getOpenid()!=null){
                openidSet.add(one.getOpenid());
            }
        }
        return openidSet;
    }

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

@ -3,17 +3,22 @@ package com.yihu.wlyy.service.survey;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.survey.*;
import com.yihu.wlyy.entity.manage.User;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.wechat.WechatTemplateConfig;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.repository.manage.UserDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.http.HttpResponse;
import com.yihu.wlyy.util.http.HttpUtils;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONException;
@ -21,6 +26,7 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@ -39,6 +45,9 @@ import java.util.*;
@Transactional
public class ManagerQuestionnaireService extends BaseService {
    @Value("${customerService.url}")
    private String customerUrl;
    @Autowired
    private SurveyDao surveyDao;
    @Autowired
@ -88,7 +97,11 @@ public class ManagerQuestionnaireService extends BaseService {
    @Autowired
    private WechatTemplateConfigDao templateConfigDao;
    @Autowired
    private SurveyScreenResultService surveyScreenResultService;
    private DoctorService doctorService;
    @Autowired
    private UserDao userDao;
    @Autowired
    private SurveyQuestionResultDao questionResultDao;
    private Logger logger = LoggerFactory.getLogger(this.getClass());
@ -1815,4 +1828,137 @@ public class ManagerQuestionnaireService extends BaseService {
        //更改调查对象表答题状态为已答
        //surveyUserDao.modifyStatus(surveyCode, patient);
    }
    //查询出推送居民
    public List<Map<String, Object>> initPatient(String labelUnitType, String labelSexType, String labelServerType, String labelDiseaseType, String labelHealthType, String currentUserRole, String currentUserRoleLevel) {
        String tableSql = " select p.code as service_patient_code ,w.`name` as service_patient_name,w.ssc,w.idcard,w.mobile,w.hospital,w.hospital_name,h.town,h.town_name from wlyy_sign_family w ,wlyy_admin_team t, dm_hospital h  ";
        String whereSql = " where w.status>0 and w.expenses_status=1 and w.admin_team_code=t.id and t.org_code=h.code ";
        //通过登录的角色区域权限 限制所属患者条件
        if (StringUtils.isNotBlank(labelUnitType)) {
            switch (currentUserRoleLevel) {
                case "1": {
                    whereSql += " and h.city in (" + labelUnitType + ")";
                    break;
                }
                case "2": {
                    whereSql += " and h.town in (" + labelUnitType + ")";
                    break;
                }
                case "3": {
                    whereSql += " and h.code in (" + labelUnitType + ")";
                    break;
                }
            }
        } else {
            switch (currentUserRoleLevel) {
                case "1": {
                    whereSql += " and h.province = '" + currentUserRole + "'";
                    break;
                }
                case "2": {
                    whereSql += " and h.city = '" + currentUserRole + "'";
                    break;
                }
                case "3": {
                    whereSql += " and h.town = '" + currentUserRole + "'";
                    break;
                }
                case "4": {
                    whereSql += " and h.code = '" + currentUserRole + "'";
                    break;
                }
            }
        }
        if (StringUtils.isNotBlank(labelServerType)) {
            tableSql += " , wlyy_sign_family_server s   ";
            whereSql += " and s.server_type in (" + labelServerType + " ) and w.code= s.sign_code";
        }
        tableSql += " , wlyy_patient p  ";
        whereSql += " and p.code=w.patient AND p.openid IS NOT NULL and p.openid <>'' ";
        if (StringUtils.isNotBlank(labelSexType)) {
            whereSql += " and p.sex in (" + labelSexType + ") ";
        }
        List<Map<String, Object>> groupPatient = null;
        if (StringUtils.isNotBlank(labelHealthType) || StringUtils.isNotBlank(labelDiseaseType)) {
            String sql = "SELECT DISTINCT s.patient as service_patient_code, f.`name` as service_patient_name, f.ssc,f.idcard,f.mobile,f.hospital,f.hospital_name,h.town,h.town_name  FROM ( SELECT t.patient," +
                    " GROUP_CONCAT(',',t.label_type,t.label,',') label FROM " +
                    " wlyy_sign_patient_label_info t WHERE t.patient IN (" +
                    tableSql + whereSql + ") AND t. STATUS = 1 GROUP BY t.patient ) s LEFT JOIN wlyy_sign_family f on s.patient=f.patient LEFT JOIN dm_hospital h on f.hospital=h.`code` where 1=1 ";
            if (StringUtils.isNotBlank(labelHealthType)) {
                String[] aa = labelHealthType.split(",");
                String bb = "";
                for (String a : aa) {
                    bb += " OR s.label LIKE '%,2" + a + ",%'";
                }
                sql += " AND ( " + bb.substring(3) + " )";
            }
            if (StringUtils.isNotBlank(labelDiseaseType)) {
                String[] aa = labelDiseaseType.split(",");
                String bb = "";
                for (String a : aa) {
                    bb += " OR s.label LIKE '%,3" + a + ",%'";
                }
                sql += " AND ( " + bb.substring(3) + " )";
            }
            sql += "and f.status>0 and f.expenses_status=1";
            groupPatient = jdbcTemplate.queryForList(sql);
        } else {
            groupPatient = jdbcTemplate.queryForList(tableSql + whereSql);
        }
        return groupPatient;
    }
    /**
     * 调用集美客服派发问卷协同服务接口
     * @param jsonData
     * @param patientInfo
     * @param doctor
     * @return
     * @throws Exception
     */
    public String createWorkOrder(String jsonData, List<Map<String, Object>> patientInfo, String doctor) throws Exception{
        JSONObject object = new JSONObject(jsonData);
        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("jsonData", object.toString());
        HttpResponse response = null;
        response = HttpUtils.doPost(customerUrl + "wlyy-manage/createWorkOrder", param);
        JSONObject rs = new JSONObject(response.getContent());
        return rs.getString("message");
    }
    /**
     * 保存问卷调查结果和答案
     * @param jsonData
     * @param patientCode
     * @param customerCode
     * @return
     * @throws Exception
     */
    public String saveQuestionResultAndAnswer(JSONObject jsonData, String patientCode, String customerCode) throws Exception {
        String surveyCode = jsonData.get("surveyCode").toString();
        SurveyTemplates templates = surveyTemplatesDao.findById(surveyCode);
        Patient patient = patientDao.findByCode(patientCode);
        User user = userDao.findByCode(customerCode);
        SurveyQuestionResult questionResult =  new SurveyQuestionResult();
        String code = getCode();
        questionResult.setCode(code);
        questionResult.setTemplateCode(templates.getCode());
        questionResult.setTemplateTitle(templates.getTitle());
        questionResult.setPatientCode(patient.getCode());
        questionResult.setPatientName(patient.getName());
        questionResult.setType(1);
        questionResult.setCreateUser(customerCode);
        questionResult.setCreateUserName(user.getName());
        questionResult.setCreateTime(new Date());
        questionResultDao.save(questionResult);
        this.saveAnswer(patientCode, code, jsonData);
        return code;
    }
}

+ 13 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/task/PushMsgTask.java

@ -421,9 +421,9 @@ public class PushMsgTask {
            String temp_id = "";
            if (type == 3) {
                if (json.has("isPublic") && json.getInt("isPublic") == 1) {
                    temp.setUrl(url + "jbsq/html/public-consult-detail.html?openid=" + openid + "&code=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                    temp.setUrl(url + "jbsq/html/public-consult-detail.html?openid=" + openid + "&code=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                } else {
                    temp.setUrl(url + "yszx/html/consulting-doctor.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                    temp.setUrl(url + "yszx/html/consulting-doctor.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                }
                temp_id = template_consult_notice;
                temp.setTemplate_id(temp_id);
@ -458,7 +458,7 @@ public class PushMsgTask {
                } else {
                    if (json.has("agent") && ("1".equals(json.getString("agent")))) {
//                        发送给授权代理人
                        temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + json.getString("represented") + "&signCode=" + json.getString("signCode"));
                        temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):"") + "&signCode=" + json.getString("signCode"));
                    } else if (json.has("agent") && ("0".equals(json.getString("agent")))) {
//                        发送给自己
                        temp.setUrl(url + "qygl/html/pay_flow.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&isRenew=" + isRenew + "&signState=" + signState + "&represented=" + json.getString("represented") + "&signCode=" + json.getString("signCode"));
@ -484,7 +484,7 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("content"));
                m.put("keyword4", keyword4);
            } else if (type == 4) {
                temp.setUrl(url + "yszd/html/guidance-detail.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&id=" + String.valueOf(json.get("id")) + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "yszd/html/guidance-detail.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&id=" + String.valueOf(json.get("id")) + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp_id = template_health_notice;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -508,7 +508,7 @@ public class PushMsgTask {
                keyword5.setValue(json.getString("content"));
                m.put("keyword5", keyword5);
            } else if (type == 5) {
                temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "ssgg/html/doctor-homepage-new.html?openid=" + openid + "&state=" + json.getString("doctor") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp_id = template_termination;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -528,7 +528,7 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("date"));
                m.put("keyword4", keyword4);
            } else if (type == 6) {
                temp.setUrl(url + "wdyy/html/detail-appointment.html?openid=" + openid + "&orgCode=" + json.get("orgCode") + "&id=" + json.getString("id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "wdyy/html/detail-appointment.html?openid=" + openid + "&orgCode=" + json.get("orgCode") + "&id=" + json.getString("id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp_id = template_appoint_success;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -548,7 +548,7 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("date"));
                m.put("planstarttime", keyword4);
            } else if (type == 7) {
                temp.setUrl(url + "wdyy/html/my-appointment.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "wdyy/html/my-appointment.html?openid=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp_id = template_appoint_failed;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -588,7 +588,7 @@ public class PushMsgTask {
                keyword4.setValue(json.getString("content"));
                m.put("remark", keyword4);
            } else if (type == 9) {
                temp.setUrl(url + "jkjy/html/article.html?openid=" + openid + "&dataId=" + json.getString("article") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "jkjy/html/article.html?openid=" + openid + "&dataId=" + json.getString("article") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp_id = template_healthy_article;
                temp.setTemplate_id(temp_id);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -615,7 +615,7 @@ public class PushMsgTask {
                if (json.has("url")) {
                    temp.setUrl(url + json.getString("url"));
                } else {
                    temp.setUrl(url + "qygl/html/signing-doctors.html?openid=" + openid + "&state=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                    temp.setUrl(url + "qygl/html/signing-doctors.html?openid=" + openid + "&state=" + openid + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                }
                temp.setTemplate_id(template_doctor_change);
                WechatTemplateData keyword1 = new WechatTemplateData();
@ -636,7 +636,7 @@ public class PushMsgTask {
                if (json.has("url")) {
                    temp.setUrl(url + json.getString("url"));
                } else {
                    String xinurl = url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented");
                    String xinurl = url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):"");
//                temp.setUrl(url + "survey/html/survey_info.html?openid=" + openid + "&state=" + openid + "&survey_id=" + json.getString("survey_id") + "&toUser=" + json.getString("toUser") + "&toName=" + name);
                    temp.setUrl(xinurl);
                }
@ -719,7 +719,7 @@ public class PushMsgTask {
                keyword1.setValue(json.getString("keyword1"));
                m.put("keyword1", keyword1);
            } else if (type == 16) {
                temp.setUrl(url + "xuqian/html/information.html?openid=" + openid + "&changeDoctor=" + 1 + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "xuqian/html/information.html?openid=" + openid + "&changeDoctor=" + 1 + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -730,7 +730,7 @@ public class PushMsgTask {
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
            } else if (type == 17) {
                temp.setUrl(url + "yszx/html/manyidu.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented"));
                temp.setUrl(url + "yszx/html/manyidu.html?openid=" + openid + "&consult=" + json.getString("consult") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):""));
                temp.setTemplate_id(template_doctor_survey);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");
@ -853,7 +853,7 @@ public class PushMsgTask {
                keyword2.setValue(json.getString("keyword2"));
                m.put("keyword2", keyword2);
            }else if (type==25){
                temp.setUrl(url + "kfgl/html/plan-item-detail.html?openid=" + openid + "&planIds=" + json.getString("planIds") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + json.getString("represented")+"&doctor="+json.getString("doctor"));
                temp.setUrl(url + "kfgl/html/plan-item-detail.html?openid=" + openid + "&planIds=" + json.getString("planIds") + "&toUser=" + json.getString("toUser") + "&toName=" + name + "&represented=" + (StringUtils.isNotEmpty(json.getString("represented"))?json.getString("represented"):"")+"&doctor="+json.getString("doctor"));
                temp.setTemplate_id(template_doctor_service);
                WechatTemplateData keyword1 = new WechatTemplateData();
                keyword1.setColor("#000000");

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/account/WechatController.java

@ -339,6 +339,8 @@ public class WechatController extends WeixinBaseController {
            if (!"undefined".equals(openid) && StringUtils.isNotBlank(openid)) {
                patient.setOpenid(openid);
                patient.setOpenidTime(new Date());
            }else{
            }
//            if (!org.springframework.util.StringUtils.isEmpty(openid)) {
//                patient.setOpenid(openid);
@ -424,8 +426,8 @@ public class WechatController extends WeixinBaseController {
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);
                } else if (StringUtils.isEmpty(openid)) {
                    errorMessage = "无效的OpenID!";
                } else if (StringUtils.isEmpty(openid)||"undefined".equals(openid)||openid.length()<10) {
                    errorMessage = "获取验证信息失败!";
                    loginLog.setErrorMessage(errorMessage);
                    loginLogService.saveLog(loginLog);
                    return error(-1, errorMessage);

+ 15 - 46
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandingService.java

@ -1,9 +1,7 @@
package com.yihu.wlyy.web.data;
import com.alibaba.fastjson.JSON;
import com.yihu.device.entity.DeviceDetail;
import com.yihu.es.entity.HealthEduArticleES;
//import com.yihu.es.entity.MapDataDTO;
import com.yihu.wlyy.config.es.ElastricSearchSave;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.device.PatientDeviceLog;
@ -19,31 +17,26 @@ import com.yihu.wlyy.repository.patient.PatientDeviceDao;
import com.yihu.wlyy.repository.patient.PatientDeviceLogDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.device.DeviceDetailService;
import com.yihu.wlyy.service.app.device.PatientDeviceService;
import com.yihu.wlyy.service.app.health.bank.CreditLogService;
import com.yihu.wlyy.service.app.health.bank.TaskService;
import com.yihu.wlyy.util.*;
import net.sf.json.JSONArray;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.StringEscapeUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BatchPreparedStatementSetter;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
//import com.yihu.es.entity.MapDataDTO;
/**
 * Created by Administrator on 2016.10.17.
 */
@ -828,44 +821,20 @@ public class DataHandingService {
     * 24H干预指导率数据清洗
     */
    @Transactional(rollbackFor = Exception.class)
    public void abnormalSignRinse() throws Exception{
        int index =0;
        int a =0;
        while (true){
            a = index*1000;
            String sql = "select i.czrq,i.id,i.user as patient,m.receiver as doctor from wlyy.wlyy_message m " +
                    " LEFT JOIN device.wlyy_patient_health_index i on m.tz_code=i.id " +
                    " where m.type =2 and m.tz_type in ('1','2') and m.create_time>='2018-07-01 00:00:00' and m.create_time<='2018-09-26 16:00:00'  " +
                    " and i.manage_result=2 limit "+a+",1000";
            List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql);
            Date tzCzrq = null;
            Date guidanceCzrq =null;
            String guidanceSql = "";
            String patient ="";
            String doctor ="";
            long h24 = 1000*60*60*24+10;
            String tzCzrqStr ="";
            String guidanceCzrqStr ="";
            String tempSql = "";
            for(Map<String,Object> one: resultList){
                tzCzrq = (Date)one.get("czrq");
                guidanceCzrq = new Date(tzCzrq.getTime()+h24);
                tzCzrqStr = DateUtil.dateToStrLong(tzCzrq);
                guidanceCzrqStr = DateUtil.dateToStrLong(guidanceCzrq);
                patient = one.get("patient")+"";
                doctor = one.get("doctor")+"";
                guidanceSql = " select * from wlyy.wlyy_patient_health_guidance where patient='"+patient+"' and doctor='"+doctor+"' and czrq>='"+tzCzrqStr+"' and czrq<='"+guidanceCzrqStr+"'";
                List<Map<String,Object>> resultList2 = jdbcTemplate.queryForList(guidanceSql);
                if(resultList2!=null&&resultList2.size()>0){//有效干预
                    tempSql = "update device.wlyy_patient_health_index set manage_result=1 where id="+one.get("id");
                    jdbcTemplate.execute(tempSql);
                }
            }
            if(resultList.size()<1000){
                return;
    public void abnormalSignRinse() throws Exception {
        String sql = " select i.* from device.wlyy_patient_health_index i where i.manage_result=2 and i.czrq>='2018-07-01 00:00:00' order by id desc ";
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql);
        Date czrq = null;
        Date record_date = null;
        long h24 = 1000 * 60 * 60 * 24 + 10;
        String tempSql = "";
        for (Map<String, Object> one : resultList) {
            czrq = (Date) one.get("czrq");
            record_date = (Date) one.get("record_date");
            if (czrq.getTime() - record_date.getTime() <= h24) {
                tempSql = "update device.wlyy_patient_health_index set manage_result=1 where id=" + one.get("id");
                jdbcTemplate.execute(tempSql);
            }
            index++;
        }
    }
}

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

@ -6,7 +6,6 @@ import com.yihu.wlyy.repository.specialist.SpecialDiseaseDao;
import com.yihu.wlyy.repository.wechat.WechatTemplateConfigDao;
import com.yihu.wlyy.service.app.survey.SurveyScreenResultService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
@ -23,6 +22,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
 * 医生端-疾病筛查
 * Created by zhangdan on 2018/7/2.
@ -227,4 +229,23 @@ public class DoctorSurveyScreenResultController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "/createWorkOrder",method = RequestMethod.POST)
    @ApiOperation(value = "创建协同服务")
    public String getAllQuestions(@ApiParam(name = "jsonData",value = "协同服务json字符串")
                                  @RequestParam(value = "jsonData",required = true)String jsonData,
                                  @ApiParam(name = "labelType", value = "疾病类型", defaultValue = "3")
                                  @RequestParam(value = "labelType", required = true) String labelType,
                                  @ApiParam(name = "serverType",value = "多个条件以逗号分割")
                                  @RequestParam(value = "serverType", required = true) String serverType,
                                  @ApiParam(name = "teamCode",value = "行政团队id")
                                  @RequestParam(value = "teamCode", required = true) Long teamCode){
        try {
            List<Map<String, Object>> patientInfo = surveyScreenResultService.initPatient(getUID(), labelType, serverType, teamCode);
            return write(200, "查询成功!", "data", surveyScreenResultService.createWorkOrder(jsonData, patientInfo, getUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
}

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

@ -586,4 +586,54 @@ public class ManagerQuestionnaireController extends WeixinBaseController {
        }
    }
    @RequestMapping(value = "saveResultAndAnswer", method = RequestMethod.POST)
    @ApiOperation(value = "协同服务保存用户答案")
    public String saveResultAndAnswer( @RequestParam String jsonData,
                                       @ApiParam(value = "居民code")@RequestParam(value = "patientCode")String patientCode,
                                       @ApiParam(value = "客服code")@RequestParam(value = "customerCode")String customerCode,
                                       @ApiParam(value = "问卷标签")@RequestParam(value = "labelType")Integer labelType,
                                       @ApiParam(value = "筛查入口(labelType=5时要填),0是第一次筛查 1是再次评估")@RequestParam(value = "isAgain")int isAgain,
                                       @ApiParam(value = "来源(1医生发放 2居民自我评估)")@RequestParam(value = "source")int source) {
        try {
            JSONObject json = new JSONObject(jsonData);
            if (labelType==5){
                return  write(200, "保存成功!","data",surveyScreenResultService.saveScreenResultAndAnswer(patientCode, customerCode, isAgain, source, json));
            }else {
                return write(200, "保存成功!", "data", managerQuestionnaireService.saveQuestionResultAndAnswer(json, patientCode, customerCode));
            }
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "保存失败!");
        }
    }
    @RequestMapping(value = "/createWorkOrder",method = RequestMethod.POST)
    @ApiOperation(value = "创建协同服务")
    public String getAllQuestions(@ApiParam(name = "jsonData",value = "协同服务json字符串")
                                      @RequestParam(value = "jsonData",required = true)String jsonData,
                                  @ApiParam(name = "labelUnitType", value = "标签类型  1:下属单位,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelUnitType", required = false, defaultValue = "") String labelUnitType,
                                  @ApiParam(name = "labelSexType", value = "标签类型  2:性别,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelSexType", required = false, defaultValue = "") String labelSexType,
                                  @ApiParam(name = "labelServerType", value = "标签类型  3:服务类型,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelServerType", required = false, defaultValue = "") String labelServerType,
                                  @ApiParam(name = "labelDiseaseType", value = "标签类型  4:疾病类型,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelDiseaseType", required = false, defaultValue = "") String labelDiseaseType,
                                  @ApiParam(name = "labelHealthType", value = "标签类型  5:健康情况,多个用逗号分隔", required = false)
                                      @RequestParam(value = "labelHealthType", required = false, defaultValue = "") String labelHealthType,
                                  @ApiParam(name = "currentUserRole", value = "当前登录的角色code", required = false)
                                      @RequestParam(value = "currentUserRole", required = false) String currentUserRole,
                                  @ApiParam(name = "currentUserRoleLevel", value = "当前登录的角色级别", required = false)
                                      @RequestParam(value = "currentUserRoleLevel", required = false) String currentUserRoleLevel) {
        try {
            List<Map<String, Object>> patientInfo = managerQuestionnaireService.initPatient(labelUnitType, labelSexType, labelServerType, labelDiseaseType, labelHealthType, currentUserRole, currentUserRoleLevel);
            return write(200, "查询成功!", "data", managerQuestionnaireService.createWorkOrder(jsonData, patientInfo, getUID()));
        } catch (Exception e) {
            e.printStackTrace();
            return write(-1, "查询失败!");
        }
    }
}

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java

@ -613,7 +613,7 @@ public class PatientBookingController extends WeixinBaseController{
        return json;
    }
    @RequestMapping(value = "/imm/findWzymBymykh", method = RequestMethod.GET)
   /* @RequestMapping(value = "/imm/findWzymBymykh", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:获取计划免疫接种记录")
@ -628,7 +628,7 @@ public class PatientBookingController extends WeixinBaseController{
            return error(-1, e.getMessage());
        }
    }
    
    */
    /**
     *-----------------计划免疫预约相关接口--------------END
     */

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

@ -261,13 +261,13 @@ public class FamilyMemberController extends WeixinBaseController {
            }
            PatientFamilyMember member = familyMemberDao.findByPatientAndFamilyMember(patient,familyMember);
            if(member==null){
                return write(1,"不是家人","data", json);
                return write(100,"不是家人","data", json);
            }
            if(1==member.getIsAuthorize()){
                return write(200, "查询成功", "data", json);
            }
            return write(1,"未授权","data", json);
            return write(100,"未授权","data", json);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/util/WeiXinOpenIdUtils.java

@ -133,7 +133,7 @@ public class WeiXinOpenIdUtils {
    }
    public String getTitleMes(Patient p, int ralation, String dealerName) throws Exception {
        return "因您是" + relations.get(familyRelationTrans(p, ralation)) + p.getName() + "的代理人,故请将该消息传达给" + dealerName + ":";
        return "因您是" + "家人" + p.getName() + "的代理人,故请将该消息传达给" + dealerName + ":";
    }
    /**

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

@ -50,6 +50,9 @@ healthBank:
#康复计划配置
rehabilitation:
  url: http://localhost:10055/svr-wlyy-rehabilitation/
#集美客服配置
customerService:
  url: http://172.19.103.72:8080/customer-service/
#小程序
applets:

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

@ -47,7 +47,9 @@ healthBank:
#康复计划配置
rehabilitation:
  url: http://localhost:10055/svr-rehabilitation/
#集美客服配置
customerService:
  url: http://172.19.103.72:8080/customer-service/
#小程序
applets:
  appId: wx0e663ce069b5170c

+ 19 - 19
patient-co/patient-co-wlyy/src/main/resources/application-test.yml

@ -58,45 +58,45 @@ wechat:
  accId: gh_710bf0b315a1
  message:
   ##医生追加建议提醒 --签约邀请
   doctor_invitel_template: uXdBJVbrhKG-WLaCG4s8C4SXSr2kknQ94vKFt-3rIiA
   doctor_invitel_template: YA8VtN_JYORLHrbEhQkNoRjlpJXIGVGnb4_OhVq4OBs
   #咨询回复
   template_consult_notice: dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18
   template_consult_notice: oGFfTWPEYvwwfmcIK1hquZ4-cVXdNomV3bCMLfj97Jc
   #签约成功
   template_sign_success: VYGj8OUKj6FH4i4_nZS2UAHurJxQHx-7_OBPILIdB8s
   template_sign_success: SQBxvSvX_JA5xez11MIFvxzamV0w3i3DeU8yB8O1lUY
   #签约失败
   template_sign_failed: m221Jrkm0UUY00ExTCpQNTB8t_1U_V4LR9Bg8BgH9-o
   template_sign_failed: sFyAMmdJjzeqjzQvRcjIajDtUZx3pBhTGxRyj-A-uuQ
   #健康指导提醒
   template_health_notice: 5Nts8lA_at9Cd1JuTK-qDxx95lchpcmUfPTEwYDgXYQ
   template_health_notice: hOu3swzpEi07jY5ojEB1vd6M6pflksn3pgfAQ6R6NT0
   #解约提醒
   template_termination:  qZm1NwSueAsbHaOf9DrnLoSj0X5gZuh9W7aDYzLWNds
   template_termination:  K1rUqmIJ6RvQviit1r_ZyPCRmjdZyFZVe0_zKeVWu30
   #预约成功
   template_appoint_success:  vU5x2tGyk1zUngBrEqMfnFqqMa6M8J98w8k5MCSUYM
   template_appoint_success:  3JNK8saVZvWUTWZ1veamC_pAEJPOLorj0sRKv1_V6-Y
   #预约取消
   template_appoint_failed:  r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
   template_appoint_failed:  iq9An2I_WgUC2BnouzSpL0bDflAO6B_AQw5TjTrYKgU
   #缴费提醒
   template_expenses_remind:  pZby4Mz3H5angmjGTuvXzo9lwlaVfEiqORwI8soI-5E
   template_expenses_remind:  umuDSVNrUy_yYPmENRg1BHszW3sDpFtCCPEdobXxAmQ
   #健康教育
   template_healthy_article: aO_qqk5nAXaGXhsikPVLNelqzwlrp1LTPfIQ1qRMpxo
   template_healthy_article: dH8ML1nDOruIAUnA9dv19w4HF95p_xiHcmpq-Noutxo
   #医生变更
   template_doctor_change:  V5h0F84t972kUzQvWy8qYrgdaYGJVj10pFeFVl19Nb8
   template_doctor_change:  RMKwJ-PLHP-uBwjJlHDgPaVFZhjuXvhSO7V8Dwh7vPc
   #问卷调查
   template_doctor_survey:  OqQXrb-e43_TJpq_70_K_y6vYJgY5mpjFYY4c5RWFP4
   #审核结果通知
   template_doctor_audit:  lCtOgJgL1tBJbAytqN7cn-FgCH_Usg99FENEy2TrC08
   template_doctor_audit:  kyrkan8cWQ22J_NC01e8yGwsn75MeUtfgdCrZKkwSLQ
   #服务结果通知
   template_doctor_service:  i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw
   template_doctor_service:  2hEhp2bLfmM-7Goc6rJ3EE4a4wvuhyndKufruYTk6A0
   #体检报告提醒
   template_physical_examination:  tlsPJlgA90-I73j2QudyMG7C-LmrMn1lC4_UnJPyWSM
   template_physical_examination:  tlsPJlgA90-I73j2QudyMG7C-LmrMn1lC4_UnJPyWSM·
   #处理结果通知
   template_deal_with:  VagkqFW_LFqLKE3gP2wmPtUfDWQOah40XMloipfi1do
   template_deal_with:  q9AiUpG7h2_4MUVE7iIKLV8lVwVaytTrHozqnkPGSes
   #设备绑定结果通知
   template_patient_bind_device: 1GWPw6LFcSuz2LFTo6LhE-YY8abtmcKRvor1fUzfxBE
   template_patient_bind_device: GJD0OC5HnmFOyj9Bcn_LQEYxwIg2t2jAdOX3jKoqaC8
   #积分到账通知
   template_healthbank_credit: A2L6WBm1p6bDPYGkGnUmoMvpWlRruP2lapYwHfLV7Rg
   template_healthbank_credit: tY34D3fSojaYz1lJJ612eSbC4uR0JhDc20Z6MZKSzVk
   #支付提醒
   template_to_be_pay: Y5d-V3qW78ThFEi_DuepFdZ3dn1FpHeL2NzH0ilw-qM
   template_to_be_pay: MKbDtG8gDdxAVEZH8LMJqiDKKyWfbMEECyc6BI02nXA
   #支付成功通知
   template_pay_success: wetf1x_yZ7iKu6wRIld6KMXCO3NVase4VvhQrQxNWEo
   template_pay_success: UVsmMSLF4gInbZkaprS3pqRyQ5eteR09lJvaRfY9PTo
  imgUrl:
    #居民wifi图片地址
    patient_wifi_pic_url: group1/M00/0E/F7/rBFuWltgKzGAKylNAABYgyiykZs261.png