Przeglądaj źródła

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

chenweida 7 lat temu
rodzic
commit
c1cb669138
26 zmienionych plików z 634 dodań i 177 usunięć
  1. 8 5
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java
  2. 8 13
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  3. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  4. 10 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/WebMvcConfig.java
  5. 41 18
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java
  6. 9 6
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java
  7. 8 13
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  8. 164 39
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/account/CustomerService.java
  9. 35 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/HealthMessageJob.java
  10. 4 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java
  11. 38 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java
  12. 4 0
      patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml
  13. 4 0
      patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml
  14. 4 0
      patient-co/patient-co-wlyy-job/src/main/resources/application-prod.yml
  15. 4 0
      patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml
  16. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java
  17. 25 19
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java
  18. 15 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowupDrugsService.java
  19. 33 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  20. 7 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  21. 40 30
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  22. 27 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/call/CustomerService.java
  23. 105 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java
  24. 23 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/call/CallRecordController.java
  25. 8 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  26. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

+ 35 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/HealthMessageJob.java

@ -1,14 +1,19 @@
package com.yihu.wlyy.job;
package com.yihu.wlyy.job;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.job.QuartzJobLog;
import com.yihu.wlyy.entity.job.QuartzJobLog;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.message.Message;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.job.QuartzJobLogDao;
import com.yihu.wlyy.repository.job.QuartzJobLogDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.repository.message.MessageDao;
import com.yihu.wlyy.task.NoticeJobPushMsgTask;
import com.yihu.wlyy.task.NoticeJobPushMsgTask;
import com.yihu.wlyy.util.DBExtract;
import com.yihu.wlyy.util.DBExtract;
import com.yihu.wlyy.util.HttpClientUtil;
import net.sf.json.JSONArray;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
import net.sf.json.JSONObject;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.quartz.Job;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.quartz.JobExecutionException;
@ -43,6 +48,14 @@ public class HealthMessageJob implements Job {
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    @Autowired
    @Autowired
    private QuartzJobLogDao quartzJobLogDao;
    private QuartzJobLogDao quartzJobLogDao;
    @Value("${doctorAssistant.api}")
    private String doctorAssistant;
    @Value("${doctorAssistant.target_url}")
    private String targetUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private DoctorDao doctorDao;
    @Transactional
    @Transactional
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
@ -112,6 +125,28 @@ public class HealthMessageJob implements Job {
                message.setReceiver(teamLeader);
                message.setReceiver(teamLeader);
                messageDao.save(message);
                messageDao.save(message);
                quartzJobLogDao.save(quartzJobLog);
                quartzJobLogDao.save(quartzJobLog);
                try {
                    //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                    Doctor doctor = doctorDao.findByCode(teamLeader);
                    String doctorOpenID = doctor.getOpenid();
                    if (!StringUtils.isEmpty(doctorOpenID)) {
                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                        List<NameValuePair> sendParams = new ArrayList<>();
                        sendParams.add(new BasicNameValuePair("type", "9"));
                        sendParams.add(new BasicNameValuePair("openId", doctorOpenID));
                        sendParams.add(new BasicNameValuePair("url", targetUrl));
                        sendParams.add(new BasicNameValuePair("first", doctor.getName()+"医生您好。" + content));
                        sendParams.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                        SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                        String date = format.format(new Date());
                        String keywords = "分配健管师" + "," + date  ;
                        sendParams.add(new BasicNameValuePair("keywords", keywords));
                        httpClientUtil.post(url, sendParams, "UTF-8");
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                }
                // 异常通知
                // 异常通知
                JSONObject json = new JSONObject();
                JSONObject json = new JSONObject();

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java

@ -24,6 +24,10 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    @Query("select a from Followup a where a.creater = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    @Query("select a from Followup a where a.creater = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByCreater(String creater, Date begin, Date end, Pageable pageRequest) throws Exception;
    List<Followup> findByCreater(String creater, Date begin, Date end, Pageable pageRequest) throws Exception;
    //查询未完成有效随访计划记录
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupPlanDate between ?2 and ?3 and a.status NOT IN ('0', '1') ")
    List<Followup> getByDoctorPlan(String doctor, Date begin, Date end) throws Exception;
    @Query(value = "select a.* from wlyy_followup a where a.doctor_code in ?1 and a.patient_code = ?2 and a.followup_class=?3 and a.status ='1' order by a.followup_date DESC limit 1",nativeQuery = true)
    @Query(value = "select a.* from wlyy_followup a where a.doctor_code in ?1 and a.patient_code = ?2 and a.followup_class=?3 and a.status ='1' order by a.followup_date DESC limit 1",nativeQuery = true)
    Followup findLastFollowup(String[] doctors,String patientCode,String followClass) throws Exception;
    Followup findLastFollowup(String[] doctors,String patientCode,String followClass) throws Exception;

+ 38 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -22,10 +22,14 @@ import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.task.FollowupUploadTask;
import com.yihu.wlyy.task.FollowupUploadTask;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Pageable;
@ -34,6 +38,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
import javax.transaction.Transactional;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.*;
/**
/**
@ -82,6 +87,12 @@ public class FollowUpService extends BaseService {
    private PatientService patientService;
    private PatientService patientService;
    @Autowired
    @Autowired
    private PushMsgTask pushMsgTask;
    private PushMsgTask pushMsgTask;
    @Value("${doctorAssistant.api}")
    private String doctorAssistant;
    @Value("${doctorAssistant.target_url}")
    private String targetUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    /**
    /**
@ -680,6 +691,33 @@ public class FollowUpService extends BaseService {
                    list.add(message);
                    list.add(message);
                    // 推送消息给医生
                    // 推送消息给医生
                    pushMsgTask.put(doctor, "4", title, content, "");
                    pushMsgTask.put(doctor, "4", title, content, "");
                    try {
                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        List<Followup> followups = followupDao.getByDoctorPlan(doctor,format.parse(start),format.parse(end));
                        for (Followup followup:followups) {
                            //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                            Doctor doctor1 = doctorDao.findByCode(doctor);
                            String doctorOpenID = doctor1.getOpenid();
                            if (StringUtils.isNotEmpty(doctorOpenID)) {
                                String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                List<NameValuePair> params = new ArrayList<>();
                                params.add(new BasicNameValuePair("type", "6"));
                                params.add(new BasicNameValuePair("openId", doctorOpenID));
                                params.add(new BasicNameValuePair("url", targetUrl));
                                params.add(new BasicNameValuePair("first", "您今日有"+count+"个随访计划待处理"));
                                params.add(new BasicNameValuePair("remark", ""));
                                SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                                String newDate = formatDate.format(new Date());
                                String keywords = followup.getPatientName() + newDate + "," + "请进入手机APP查看";
                                params.add(new BasicNameValuePair("keywords", keywords));
                                httpClientUtil.post(url, params, "UTF-8");
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                }
                messageDao.save(list);
                messageDao.save(list);

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml

@ -25,6 +25,10 @@ channel:
server:
server:
  server_url: http://weixin.xmtyw.cn/wlyy-dev/
  server_url: http://weixin.xmtyw.cn/wlyy-dev/
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://192.168.131.113:8080/
  target_url: home/html/unreadMessageStatistic.html
im:
im:

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

@ -25,6 +25,10 @@ channel:
server:
server:
  server_url: http://ehr.yihu.com/wlyy/
  server_url: http://ehr.yihu.com/wlyy/
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://192.168.131.113:8080/
  target_url: home/html/unreadMessageStatistic.html
im:
im:

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/resources/application-prod.yml

@ -26,6 +26,10 @@ channel:
server:
server:
  server_url: http://www.xmtyw.cn/wlyy/
  server_url: http://www.xmtyw.cn/wlyy/
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://www.xmtyw.cn/assistant/
  target_url: home/html/unreadMessageStatistic.html
im:
im:

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

@ -25,6 +25,10 @@ channel:
server:
server:
  server_url: http://ehr.yihu.com/wlyy/
  server_url: http://ehr.yihu.com/wlyy/
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://172.19.103.88:443/assistant/
  target_url: home/html/unreadMessageStatistic.html
im:
im:

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java

@ -28,6 +28,10 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupDate between ?2 and ?3 and a.status NOT IN ('0', '1') ")
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupDate between ?2 and ?3 and a.status NOT IN ('0', '1') ")
    List<Followup> getByDoctor(String doctor, Date begin, Date end) throws Exception;
    List<Followup> getByDoctor(String doctor, Date begin, Date end) throws Exception;
    //查询未完成有效随访计划记录
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupPlanDate between ?2 and ?3 and a.status NOT IN ('0', '1') ")
    List<Followup> getByDoctorPlan(String doctor, Date begin, Date end) throws Exception;
    @Query("select a from Followup a where a.creater = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    @Query("select a from Followup a where a.creater = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByCreater(String creater, Date begin, Date end, Pageable pageRequest) throws Exception;
    List<Followup> findByCreater(String creater, Date begin, Date end, Pageable pageRequest) throws Exception;

+ 25 - 19
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -866,25 +866,31 @@ public class FollowUpService extends BaseService {
                    pushMsgTask.put(doctor, "4", title, content, "");
                    pushMsgTask.put(doctor, "4", title, content, "");
                    //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    List<Followup> followups = followupDao.getByDoctor(doctor, format.parse(start), format.parse(end));
                    Doctor doctor1 = doctorDao.findByCode(doctor);
                    String doctorOpenID = doctor1.getOpenid();
                    if (StringUtils.isNotEmpty(doctorOpenID)) {
                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                        List<NameValuePair> params = new ArrayList<>();
                        params.add(new BasicNameValuePair("type", "6"));
                        params.add(new BasicNameValuePair("openId", doctorOpenID));
                        params.add(new BasicNameValuePair("url", targetUrl));
                        params.add(new BasicNameValuePair("first", "您今日有1个随访计划待处理"));
                        params.add(new BasicNameValuePair("remark", ""));
                        SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                        String newDate = formatDate.format(new Date());
                        String keywords = "patientName" + newDate + "," + "请进入手机APP查看";
                        params.add(new BasicNameValuePair("keywords", keywords));
                        httpClientUtil.post(url, params, "UTF-8");
                    try {
                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                        List<Followup> followups = followupDao.getByDoctorPlan(doctor,format.parse(start),format.parse(end));
                        for (Followup followup:followups) {
                            //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                            Doctor doctor1 = doctorDao.findByCode(doctor);
                            String doctorOpenID = doctor1.getOpenid();
                            if (StringUtils.isNotEmpty(doctorOpenID)) {
                                String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                List<NameValuePair> params = new ArrayList<>();
                                params.add(new BasicNameValuePair("type", "6"));
                                params.add(new BasicNameValuePair("openId", doctorOpenID));
                                params.add(new BasicNameValuePair("url", targetUrl));
                                params.add(new BasicNameValuePair("first", "您今日有"+count+"个随访计划待处理"));
                                params.add(new BasicNameValuePair("remark", ""));
                                SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                                String newDate = formatDate.format(new Date());
                                String keywords = followup.getPatientName() + newDate + "," + "请进入手机APP查看";
                                params.add(new BasicNameValuePair("keywords", keywords));
                                httpClientUtil.post(url, params, "UTF-8");
                            }
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                    }
                }
                }

+ 15 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowupDrugsService.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.service.app.followup;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.es.entity.FollowupContentESDO;
import com.yihu.wlyy.entity.dict.DmDrugsGroupItem;
import com.yihu.wlyy.entity.dict.DmDrugsGroupItem;
import com.yihu.wlyy.entity.followup.FollowupContent;
import com.yihu.wlyy.entity.followup.FollowupContent;
import com.yihu.wlyy.entity.followup.FollowupDrugs;
import com.yihu.wlyy.entity.followup.FollowupDrugs;
@ -35,11 +36,11 @@ public class FollowupDrugsService extends BaseService {
	@Autowired
	@Autowired
	private DmDrugsGroupItemDao dmDrugsGroupItemDao;
	private DmDrugsGroupItemDao dmDrugsGroupItemDao;
	@Autowired
	private SystemDictDao systemDictDao;
	@Autowired
	@Autowired
	private ObjectMapper objectMapper;
	private ObjectMapper objectMapper;
	
	@Autowired
	private FollowUpService followUpService;
	private String drugsProject = "6";
	private String drugsProject = "6";
@ -49,11 +50,18 @@ public class FollowupDrugsService extends BaseService {
	public Map<String,Object> getFollowupDrugs(String id) throws Exception
	public Map<String,Object> getFollowupDrugs(String id) throws Exception
	{
	{
		Map<String,Object> re = new HashMap<>();
		Map<String,Object> re = new HashMap<>();
		List<FollowupContent> dataList =  followupContentDao.findByFollowupIdAndFollowupProject(Long.valueOf(id),drugsProject);
		for(FollowupContent item:dataList)
		{
			re.put(item.getFollowupKey(),item.getFollowupValue());
		
		//2017-11-16 修改为从ES获取--huangwenjie
		FollowupContentESDO followupContentESDO = followUpService.esGetFollowupProjectData(id, "6");
		if(followupContentESDO != null){
			re.put("DRUG_COMPLIANCE_CODE",followupContentESDO.getDRUG_COMPLIANCE_CODE());
		}
		}
		
//		List<FollowupContent> dataList =  followupContentDao.findByFollowupIdAndFollowupProject(Long.valueOf(id),drugsProject);
//		for(FollowupContent item:dataList)
//		{
//			re.put(item.getFollowupKey(),item.getFollowupValue());
//		}
		//获取用药记录
		//获取用药记录
		List<FollowupDrugs> drugsList = followupDrugsDao.findByFollowupId(Long.valueOf(id));
		List<FollowupDrugs> drugsList = followupDrugsDao.findByFollowupId(Long.valueOf(id));

+ 33 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java

@ -33,6 +33,7 @@ import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.MessageType;
import com.yihu.wlyy.util.MessageType;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.wx.OnePayController;
import com.yihu.wlyy.web.wx.OnePayController;
@ -42,6 +43,8 @@ import com.ylzinfo.onepay.sdk.domain.ResponseParams;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import com.ylzinfo.onepay.sdk.utils.DateUtil;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import com.ylzinfo.onepay.sdk.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -81,6 +84,14 @@ public class PatientPrescriptionPayService extends BaseService {
    //    Java配置文件 后续删除
    //    Java配置文件 后续删除
    private String signType = "MD5";
    private String signType = "MD5";
    private String encryptType = "AES";
    private String encryptType = "AES";
    @Value("${doctorAssistant.api}")
    private String doctorAssistant;
    @Value("${doctorAssistant.target_url}")
    private String targetUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private DoctorDao doctorDao;
    //    引入实例
    //    引入实例
    @Autowired
    @Autowired
@ -743,6 +754,28 @@ public class PatientPrescriptionPayService extends BaseService {
                            message.setState(1);//已发送
                            message.setState(1);//已发送
                            message.setCzrq(new Date());
                            message.setCzrq(new Date());
                            messageDao.save(message);
                            messageDao.save(message);
                            try {
                                //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                                Doctor doctor = doctorDao.findByCode(receiver);
                                String doctorOpenID = doctor.getOpenid();
                                if (StringUtils.isNotEmpty(doctorOpenID)) {
                                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                        List<NameValuePair> sendParams = new ArrayList<>();
                                        sendParams.add(new BasicNameValuePair("type", "9"));
                                        sendParams.add(new BasicNameValuePair("openId", doctorOpenID));
                                        sendParams.add(new BasicNameValuePair("url", targetUrl));
                                        sendParams.add(new BasicNameValuePair("first", doctor.getName()+"医生您好。" + content + ",一个尽快分配。"));
                                        sendParams.add(new BasicNameValuePair("remark", "请进入手机APP查看"));
                                        SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                                        String date = format.format(new Date());
                                        String keywords = "分配配送员" + "," + date  ;
                                        sendParams.add(new BasicNameValuePair("keywords", keywords));
                                        httpClientUtil.post(url, sendParams, "UTF-8");
                                }
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                        }
                        //支付成功生成二维码
                        //支付成功生成二维码
                        result = prescriptionCode;
                        result = prescriptionCode;

+ 7 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java

@ -508,7 +508,6 @@ public class PrescriptionInfoService extends BaseService {
        String rs = jwPrescriptionService.getRecipe(code, p.getSsc());
        String rs = jwPrescriptionService.getRecipe(code, p.getSsc());
        com.alibaba.fastjson.JSONObject r = presModeAdapter.modelToSinglePrescription(rs);
        com.alibaba.fastjson.JSONObject r = presModeAdapter.modelToSinglePrescription(rs);
    
    
        Followup followup = followUpDao.getFollowupByPrescriptionCode(code);
        String rState = presCheckStateObj(code);
        String rState = presCheckStateObj(code);
        if ("1".equals(rState)) {
        if ("1".equals(rState)) {
            r.put("reviewedState", 1);
            r.put("reviewedState", 1);
@ -516,8 +515,11 @@ public class PrescriptionInfoService extends BaseService {
        } else {
        } else {
            r.put("reviewedState", 0);
            r.put("reviewedState", 0);
            r.put("prescriptionCode", rState);
            r.put("prescriptionCode", rState);
            
            Followup followup = followUpDao.getFollowupByPrescriptionCode(rState);
            r.put("followup",followup);
        }
        }
        r.put("followup",followup);
        
        return r;
        return r;
    }
    }
@ -868,6 +870,9 @@ public class PrescriptionInfoService extends BaseService {
        } else {
        } else {
            rs.put("prescriptionAdjust", "");
            rs.put("prescriptionAdjust", "");
        }
        }
    
        Followup followup = followUpDao.getFollowupByPrescriptionCode(code);
        rs.put("followup",followup);
        return rs;
        return rs;
    }
    }

+ 40 - 30
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java

@ -2406,7 +2406,7 @@ public class StatisticsESService {
     */
     */
    private int getLevel1NumForRedis(String index, String level, String code, String timeKey) throws Exception {
    private int getLevel1NumForRedis(String index, String level, String code, String timeKey) throws Exception {
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey, code, Integer.parseInt(level), index, "2");
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(timeKey, code, Integer.parseInt(level), index, SaveModel.timeLevel_DDL);
        return saveModel.getResult2().intValue();
        return saveModel.getResult2().intValue();
    }
    }
@ -2420,7 +2420,7 @@ public class StatisticsESService {
     * @return
     * @return
     */
     */
    private JSONArray getLevel2JsonObjectForRedis(String index, String level, String code, String timeKey) throws Exception {
    private JSONArray getLevel2JsonObjectForRedis(String index, String level, String code, String timeKey) throws Exception {
        List<SaveModel> list = elasticsearchUtil.findOneDateQuotaLevel1(timeKey, code, Integer.parseInt(level), index, "2");
        List<SaveModel> list = elasticsearchUtil.findDateAllQuotaLevel1(timeKey, timeKey,code, Integer.parseInt(level), index, SaveModel.timeLevel_DDL,"","");
//        JSONObject jo = new JSONObject();
//        JSONObject jo = new JSONObject();
        JSONArray switchJo = new JSONArray();
        JSONArray switchJo = new JSONArray();
        list.stream().forEach(one -> {
        list.stream().forEach(one -> {
@ -2723,7 +2723,7 @@ public class StatisticsESService {
            throw new RuntimeException("未找到团队信息");
            throw new RuntimeException("未找到团队信息");
        }
        }
        //1.计算签约总数
        //1.计算签约总数
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "1", "2");
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "1", SaveModel.timeLevel_ZL);
        Long sc = saveModel.getResult2().longValue();
        Long sc = saveModel.getResult2().longValue();
        JSONObject signTotal = new JSONObject();
        JSONObject signTotal = new JSONObject();
        signTotal.put("signTotal", sc);
        signTotal.put("signTotal", sc);
@ -2731,41 +2731,44 @@ public class StatisticsESService {
        //3.平均满意度
        //3.平均满意度
        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "28", "2");
        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "28", SaveModel.timeLevel_ZL);
//        String sql = "SELECT count(1) as num FROM wlyy_consult_team d WHERE d.czrq>= ? and d.czrq<=? and d.admin_team_code =? ";
//        String sql = "SELECT count(1) as num FROM wlyy_consult_team d WHERE d.czrq>= ? and d.czrq<=? and d.admin_team_code =? ";
//        Map<String, Object> map = jdbcTemplate.queryForMap(sql, startDate, endDate,admin.getId());
//        Map<String, Object> map = jdbcTemplate.queryForMap(sql, startDate, endDate,admin.getId());
        SaveModel saveModel21 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "3", "2");
        Double avgCout = saveModel2.getResult1() / saveModel21.getResult2();
        SaveModel saveModel21 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        Double avgCout = 0.0;
        if (saveModel21.getResult2().intValue()!=0){
            avgCout = saveModel2.getResult1() / saveModel21.getResult2();
        }
        Map<String, Object> avgScore = new HashMap<>();
        Map<String, Object> avgScore = new HashMap<>();
        avgScore.put("avgScore", avgCout);
        avgScore.put("avgScore", avgCout);
        rs.put(avgScore);
        rs.put(avgScore);
        //4.获取咨詢數
        //4.获取咨詢數
        SaveModel saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "3", "2");
        SaveModel saveModel3 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        Map<String, Object> consultCout = new HashMap<>();
        Map<String, Object> consultCout = new HashMap<>();
        consultCout.put("consultCount", saveModel3.getResult2().longValue());
        consultCout.put("consultCount", saveModel3.getResult2().longValue());
        rs.put(consultCout);
        rs.put(consultCout);
        //5.获取待预约
        //5.获取待预约
        SaveModel saveModel4 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "27", "2");
        SaveModel saveModel4 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "27", SaveModel.timeLevel_ZL);
        Map<String, Object> reservationCout = new HashMap<>();
        Map<String, Object> reservationCout = new HashMap<>();
        reservationCout.put("reservationCount", saveModel4.getResult2().longValue());
        reservationCout.put("reservationCount", saveModel4.getResult2().longValue());
        rs.put(reservationCout);
        rs.put(reservationCout);
        //6.获取健康教育
        //6.获取健康教育
        SaveModel saveModel5 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "59", "2");
        SaveModel saveModel5 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "59", SaveModel.timeLevel_ZL);
        Map<String, Object> articleCout = new HashMap<>();
        Map<String, Object> articleCout = new HashMap<>();
        articleCout.put("articleCount", saveModel5.getResult2().longValue());
        articleCout.put("articleCount", saveModel5.getResult2().longValue());
        rs.put(articleCout);
        rs.put(articleCout);
        //7.获取健康指导
        //7.获取健康指导
        SaveModel saveModel6 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "5", "2");
        SaveModel saveModel6 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "5", SaveModel.timeLevel_ZL);
        Map<String, Object> guidanceCout = new HashMap<>();
        Map<String, Object> guidanceCout = new HashMap<>();
        guidanceCout.put("guidanceCount", saveModel6.getResult2().longValue());
        guidanceCout.put("guidanceCount", saveModel6.getResult2().longValue());
        rs.put(guidanceCout);
        rs.put(guidanceCout);
        //8.随访数目
        //8.随访数目
        SaveModel saveModel7 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "4", "2");
        SaveModel saveModel7 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, admin.getId() + "", Integer.parseInt(SaveModel.teamLevel), "69", SaveModel.timeLevel_ZL);
        Map<String, Object> followupCout = new HashMap<>();
        Map<String, Object> followupCout = new HashMap<>();
        followupCout.put("followupCount", saveModel7.getResult2().longValue());
        followupCout.put("followupCount", saveModel7.getResult2().longValue());
        rs.put(followupCout);
        rs.put(followupCout);
@ -2788,7 +2791,8 @@ public class StatisticsESService {
            throw new RuntimeException("未找到团队信息");
            throw new RuntimeException("未找到团队信息");
        }
        }
        Long id = admin.getId();
        Long id = admin.getId();
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "1", "2", String.valueOf(Integer.parseInt(type) + 1));
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate,endDate,id+"",Integer.valueOf(SaveModel.teamLevel),"1",SaveModel.timeLevel_ZL,String.valueOf(Integer.valueOf(type)+1));
        List<Map<String, Object>> rs = new ArrayList<>();
        List<Map<String, Object>> rs = new ArrayList<>();
        for (SaveModel saveModel : list) {
        for (SaveModel saveModel : list) {
            Map<String, Object> map = new HashMap<>();
            Map<String, Object> map = new HashMap<>();
@ -2815,7 +2819,7 @@ public class StatisticsESService {
            throw new RuntimeException("未找到团队信息");
            throw new RuntimeException("未找到团队信息");
        }
        }
        Long id = admin.getId();
        Long id = admin.getId();
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "42", "2", String.valueOf(Integer.parseInt(type) + 1));
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "42", SaveModel.timeLevel_ZL, String.valueOf(Integer.parseInt(type) + 1));
        List<Map<String, Object>> rs = new ArrayList<>();
        List<Map<String, Object>> rs = new ArrayList<>();
        for (SaveModel saveModel : list) {
        for (SaveModel saveModel : list) {
            Map<String, Object> map = new HashMap<>();
            Map<String, Object> map = new HashMap<>();
@ -2828,7 +2832,7 @@ public class StatisticsESService {
    }
    }
    /**
    /**
     * 获取咨询数和未回复数
     * 获取咨询数和未回复数..
     *
     *
     * @param doctor
     * @param doctor
     * @param startDate
     * @param startDate
@ -2842,14 +2846,16 @@ public class StatisticsESService {
        if (admin == null) {
        if (admin == null) {
            throw new RuntimeException("未找到团队信息");
            throw new RuntimeException("未找到团队信息");
        }
        }
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        Long id = admin.getId();
        Long id = admin.getId();
        //家庭医生、健康咨询到达量
        //家庭医生、健康咨询到达量
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "3", "2");
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "3", SaveModel.timeLevel_ZL);
        Long totalCount = saveModel.getResult2().longValue();
        Long totalCount = saveModel.getResult2().longValue();
        //健康咨询量  未回复到达量
        //健康咨询量  未回复到达量
        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "22", "2");
        Long noReyCount = saveModel.getResult2().longValue();
        SaveModel saveModel2 = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "22", SaveModel.timeLevel_ZL);
        Long noReyCount = saveModel2.getResult2().longValue();
        JSONObject rs = new JSONObject();
        JSONObject rs = new JSONObject();
        rs.put("onReyCount", noReyCount);
        rs.put("onReyCount", noReyCount);
        rs.put("totalCount", totalCount);
        rs.put("totalCount", totalCount);
@ -2873,18 +2879,22 @@ public class StatisticsESService {
        }
        }
        Long id = admin.getId();
        Long id = admin.getId();
        //统计评分
        //统计评分
        Integer interval = Integer.parseInt(type) + 2;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "28", "2", interval + "");
        Integer interval = Integer.parseInt(type) + 1;
        List<SaveModel> list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.parseInt(SaveModel.teamLevel), "28", SaveModel.timeLevel_ZL, interval + "");
        SaveModel saveModel = null;
        SaveModel saveModel = null;
        Map<String, Object> map = null;
        Map<String, Object> map = null;
        List<Map<String, Object>> rs = null;
        List<Map<String, Object>> rs = new ArrayList<>();
        Double avgCount = 0.0;
        Double avgCount = 0.0;
        for (SaveModel one : list) {
        for (SaveModel one : list) {
            String quotaDate = dateFormat.format(one.getQuotaDate());
            String quotaDate = dateFormat.format(one.getQuotaDate());
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(quotaDate, id + "", Integer.parseInt(SaveModel.teamLevel), "59", "2");
            avgCount = one.getResult1() / saveModel.getResult2();
            if (avgCount == 0.0) {
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(quotaDate, id + "", Integer.parseInt(SaveModel.teamLevel), "59", SaveModel.timeLevel_ZL);
            //如果曾量为0,则说明没有数据。直接返回
            if(one.getResult2()!=0 && saveModel.getResult2().intValue()!=0){
                avgCount = one.getResult2() / saveModel.getResult2();
            }else if (one.getResult2()!=0 && saveModel.getResult2().intValue()==0){
                avgCount = 80.0;
                avgCount = 80.0;
            }else if (one.getResult2()==0){
                avgCount=0.0;
            }
            }
            map = new HashMap<>();
            map = new HashMap<>();
            if ("0".equals(type)) {
            if ("0".equals(type)) {
@ -3016,20 +3026,20 @@ public class StatisticsESService {
        //格式化时间
        //格式化时间
        startDate = startDate + " 00:00:00";
        startDate = startDate + " 00:00:00";
        endDate = endDate + " 23:59:59";
        endDate = endDate + " 23:59:59";
        String index = "58";
        String index = "64";
        Map<String, Object> rs = new HashedMap();
        Map<String, Object> rs = new HashedMap();
        //总数
        //总数
        SaveModel total = elasticsearchUtil.findOneDateQuotaLevel0(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, "2");
        SaveModel total = elasticsearchUtil.findOneDateQuotaLevel1NoSlaveKey1(startDate,endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, SaveModel.timeLevel_ZL);
        //进行中
        //进行中
        SaveModel processing = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, "2", "1");
        SaveModel processing = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, SaveModel.timeLevel_ZL, "1");
        //已完成
        //已完成
        SaveModel finished = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, "2", "2");
        SaveModel finished = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, SaveModel.timeLevel_ZL, "2");
        //已经取消
        //已经取消
        SaveModel canceled = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, "2", "3");
        SaveModel canceled = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, SaveModel.timeLevel_ZL, "3");
        //审核不通过
        //审核不通过
        SaveModel unPass = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, "2", "4");
        SaveModel unPass = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, SaveModel.timeLevel_ZL, "4");
        //其他原因取消
        //其他原因取消
        SaveModel other = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, "2", "5");
        SaveModel other = elasticsearchUtil.findOneDateQuotaLevel1(startDate, endDate, String.valueOf(adminTeamId), Integer.valueOf(SaveModel.teamLevel), index, SaveModel.timeLevel_ZL, "5");
        //总数
        //总数
        if (total != null) {
        if (total != null) {

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

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

+ 105 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java

@ -592,6 +592,94 @@ public class ElasticsearchUtil {
        return date;
        return date;
    }
    }
    /**
     * 获取一个指标下所有一级维度按维度分组的数据
     * @param startDate
     * @param endDate
     * @param area
     * @param level
     * @param index
     * @param timeLevel
     * @param interval
     * @param lowLevel
     * @return
     * @throws Exception
     */
    public List findDateAllQuotaLevel1(String startDate, String endDate, String area, int level, String index, String timeLevel,String interval, String lowLevel) throws Exception {
        //时间格式转换  yyyy-MM-dd转成 2017-07-17T00:00:00+0800
        if (StringUtils.isNotEmpty(startDate)) {
            if (startDate.length() > 10) {
                startDate = changeTime(startDate);
            } else {
                startDate = changeDate(startDate);
            }
        }
        if (StringUtils.isNotEmpty(endDate)) {
            if (endDate.length() > 10) {
                endDate = changeTime(endDate);
            } else {
                endDate = changeDate(endDate);
            }
        }
        StringBuffer sql = new StringBuffer();
        StringBuffer groupBy = new StringBuffer();
        String low_level = level + "";
        if (StringUtils.isNotEmpty(lowLevel)) {
            low_level = lowLevel;
        }
        if (SaveModel.teamLevel.equals(low_level)) {
            sql.append("select team,teamName,slaveKey1,slaveKey1Name,sum(result1) result1, sum(result2) result2 from " + esIndex + " where ");
            groupBy.append("  group by team,teamName,slaveKey1,slaveKey1Name");
        } else if (SaveModel.OrgLevel.equals(low_level)) {
            sql.append("select hospital,hospitalName,slaveKey1,slaveKey1Name,sum(result1) result1,sum(result2) result2 from " + esIndex + " where ");
            groupBy.append("  group by hospital,hospitalName,slaveKey1,slaveKey1Name");
        } else if (SaveModel.townLevel.equals(low_level)) {
            sql.append("select town,townName,slaveKey1,slaveKey1Name,sum(result1) result1,sum(result2) result2 from " + esIndex + " where ");
            groupBy.append("  group by town,townName,slaveKey1,slaveKey1Name" );
        } else if (SaveModel.cityLevel.equals(low_level)) {
            sql.append("select city,cityName,slaveKey1,slaveKey1Name,sum(result1) result1,sum(result2) result2 from " + esIndex + " where ");
            groupBy.append("  group by city,cityName,slaveKey1,slaveKey1Name");
        }
        if (StringUtils.isNotEmpty(area)) {
            if (SaveModel.teamLevel.equals(level + "")) {
                sql.append(" team='" + area + "'");
            } else if (SaveModel.OrgLevel.equals(level + "")) {
                sql.append(" hospital='" + area + "'");
            } else if (SaveModel.townLevel.equals(level + "")) {
                sql.append(" town='" + area + "'");
            } else if (SaveModel.cityLevel.equals(level + "")) {
                sql.append(" city='" + area + "'");
            }
            sql.append(" and ");
        }
        sql.append(" quotaCode='" + index + "'  ");
        sql.append(" and timeLevel='" + timeLevel + "'  ");
        sql.append(" and areaLevel='5'");
        if (StringUtils.isNotEmpty(startDate)) {
            sql.append(" and quotaDate>='" + startDate + "'");
        }
        if (StringUtils.isNotEmpty(endDate)) {
            sql.append(" and quotaDate<='" + endDate + "'");
        }
        //根据时间维度分组
        if (StringUtils.isNotEmpty(interval)) {
            if (SaveModel.interval_month.equals(interval)) {
                groupBy.append(" ,date_histogram(field='quotaDate','interval'='month','time_zone'='+08:00') ");
            } else if (SaveModel.interval_week.equals(interval)) {
                groupBy.append(" ,date_histogram(field='quotaDate','interval'='week','time_zone'='+08:00') ");
            } else if (SaveModel.interval_day.equals(interval)) {
                groupBy.append(" ,date_histogram(field='quotaDate','interval'='1d','time_zone'='+08:00') ");
            }
        }
        sql.append(groupBy);
        return excute(sql.toString(), SaveModel.class, "", "");
    }
    /**
    /**
     * 0级维度
     * 0级维度
     * 查询某一天某一个0级维度的指标
     * 查询某一天某一个0级维度的指标
@ -660,6 +748,23 @@ public class ElasticsearchUtil {
        return (SaveModel) list.get(0);
        return (SaveModel) list.get(0);
    }
    }
    /**
     * 1级维度
     * 查询某一个时间区间某一个1级维度的某个1级维度下的指标 例如查询65岁以上患者
     * @param startDate
     * @param endDate
     * @param area
     * @param level
     * @param index
     * @param timelevel
     * @return
     * @throws Exception
     */
    public SaveModel findOneDateQuotaLevel1NoSlaveKey1(String startDate, String endDate,String area, int level, String index, String timelevel) throws Exception {
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,  null, null, null);
        return (SaveModel) list.get(0);
    }
    /**
    /**
     * 1级维度
     * 1级维度
     * 查询某个时间区间某一个1级维度的某个1级维度下的指标 例如查询65岁以上患者
     * 查询某个时间区间某一个1级维度的某个1级维度下的指标 例如查询65岁以上患者

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

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

+ 8 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java

@ -32,7 +32,7 @@ import java.util.TreeMap;
 * Created by chenweida on 2017/10/13.
 * Created by chenweida on 2017/10/13.
 */
 */
@Controller
@Controller
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = {RequestMethod.GET, RequestMethod.POST})
@RequestMapping(value = "/esstatistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = {RequestMethod.GET, RequestMethod.POST})
@Api(description = "ES统计查询")
@Api(description = "ES统计查询")
public class EsStatisticsController extends BaseController {
public class EsStatisticsController extends BaseController {
@ -832,7 +832,7 @@ public class EsStatisticsController extends BaseController {
        try {
        try {
            return write(200, "查询成功", "data", statisticsESService.getStatTitleInfo(getUID(), startDate, endDate));
            return write(200, "查询成功", "data", statisticsESService.getStatTitleInfo(getUID(), startDate, endDate));
            //return write(200, "查询成功", "data", statisticsService.getStatTitleInfo("zbqD201703150228",startDate,endDate));
            //return write(200, "查询成功", "data", statisticsESService.getStatTitleInfo("zbqD201703150222",startDate,endDate));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
@ -859,10 +859,10 @@ public class EsStatisticsController extends BaseController {
            //判断是签约还是续签
            //判断是签约还是续签
            if ("0".equals(signType)) {
            if ("0".equals(signType)) {
                return write(200, "查询成功", "data", statisticsESService.getSignCountLineByType(getUID(), type, startDate, endDate));
                return write(200, "查询成功", "data", statisticsESService.getSignCountLineByType(getUID(), type, startDate, endDate));
                //return write(200, "查询成功", "data", statisticsService.getSignCountLineByType("xh1D201703150222",type,startDate,endDate));
                //return write(200, "查询成功", "data", statisticsESService.getSignCountLineByType("xh1D201703150222",type,startDate,endDate));
            } else {
            } else {
                return write(200, "查询成功", "data", statisticsESService.getRenewCountLineByType(getUID(), type, startDate, endDate));
                return write(200, "查询成功", "data", statisticsESService.getRenewCountLineByType(getUID(), type, startDate, endDate));
                //return write(200, "查询成功", "data", statisticsService.getRenewCountLineByType("xh1D201703150222",type,startDate,endDate));
                //return write(200, "查询成功", "data", statisticsESService.getRenewCountLineByType("xh1D201703150222",type,startDate,endDate));
            }
            }
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
@ -885,7 +885,7 @@ public class EsStatisticsController extends BaseController {
                                   @RequestParam(required = true) String isNow) {
                                   @RequestParam(required = true) String isNow) {
        try {
        try {
            return write(200, "查询成功", "data", statisticsESService.getReyStatbyTeamNow(getUID(), startDate, endDate, isNow));
            return write(200, "查询成功", "data", statisticsESService.getReyStatbyTeamNow(getUID(), startDate, endDate, isNow));
            //return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow("zbqD201703150228",startDate,endDate,isNow));
            //return write(200, "查询成功", "data", statisticsESService.getReyStatbyTeamNow("zbqD201703150222",startDate,endDate,isNow));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");
@ -927,7 +927,7 @@ public class EsStatisticsController extends BaseController {
                             @RequestParam(required = true) String type) {
                             @RequestParam(required = true) String type) {
        try {
        try {
            return write(200, "查询成功", "data", statisticsESService.getAvgLine(getUID(), startDate, endDate, type));
            return write(200, "查询成功", "data", statisticsESService.getAvgLine(getUID(), startDate, endDate, type));
            // return write(200, "查询成功", "data", statisticsService.getAvgLine("xh1D201703150222",startDate,endDate,type));
            //return write(200, "查询成功", "data", statisticsESService.getAvgLine("xh1D201703150222",startDate,endDate,type));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");
@ -1505,7 +1505,7 @@ public class EsStatisticsController extends BaseController {
            String switchIndexReson = "";
            String switchIndexReson = "";
            String signIn = "";
            String signIn = "";
            String signOut = "";
            String signOut = "";
            if ("1".equals(level)) {
            if (SaveModel.teamLevel.equals(level)) {
                //团队的转签人数
                //团队的转签人数
                switchIndex = "35";
                switchIndex = "35";
                //团队的转签原因
                //团队的转签原因
@ -1514,7 +1514,7 @@ public class EsStatisticsController extends BaseController {
                signIn = "34";
                signIn = "34";
                //团队的签出
                //团队的签出
                signOut = "35";
                signOut = "35";
            } else if ("2".equals(level)) {
            } else if (SaveModel.OrgLevel.equals(level)) {
                //社区的转签人数
                //社区的转签人数
                switchIndex = "35";
                switchIndex = "35";
                //社区的转签原因
                //社区的转签原因

+ 5 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java

@ -29,7 +29,7 @@ import java.util.*;
 * Created by lyr on 2016/08/16.
 * Created by lyr on 2016/08/16.
 */
 */
@Controller
@Controller
@RequestMapping(value = "/oldstatistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@Api(description = "统计")
@Api(description = "统计")
public class StatisticsController extends BaseController {
public class StatisticsController extends BaseController {
@ -867,7 +867,7 @@ public class StatisticsController extends BaseController {
        try {
        try {
            return write(200, "查询成功", "data", statisticsService.getStatTitleInfo(getUID(), startDate, endDate));
            return write(200, "查询成功", "data", statisticsService.getStatTitleInfo(getUID(), startDate, endDate));
            //return write(200, "查询成功", "data", statisticsService.getStatTitleInfo("zbqD201703150228",startDate,endDate));
            //return write(200, "查询成功", "data", statisticsService.getStatTitleInfo("zbqD201703150222",startDate,endDate));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
@ -922,7 +922,7 @@ public class StatisticsController extends BaseController {
                                   @RequestParam(required = true) String isNow) {
                                   @RequestParam(required = true) String isNow) {
        try {
        try {
            return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow(getUID(), startDate, endDate, isNow));
            return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow(getUID(), startDate, endDate, isNow));
            //return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow("zbqD201703150228",startDate,endDate,isNow));
            //return write(200, "查询成功", "data", statisticsService.getReyStatbyTeamNow("zbqD201703150222",startDate,endDate,isNow));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");
@ -965,8 +965,8 @@ public class StatisticsController extends BaseController {
                             @RequestParam(required = true) String endDate,
                             @RequestParam(required = true) String endDate,
                             @RequestParam(required = true) String type) {
                             @RequestParam(required = true) String type) {
        try {
        try {
            return write(200, "查询成功", "data", statisticsService.getAvgLine(getUID(), startDate, endDate, type));
            // return write(200, "查询成功", "data", statisticsService.getAvgLine("xh1D201703150222",startDate,endDate,type));
             return write(200, "查询成功", "data", statisticsService.getAvgLine(getUID(), startDate, endDate, type));
             //return write(200, "查询成功", "data", statisticsService.getAvgLine("xh1D201703150222",startDate,endDate,type));
        } catch (Exception e) {
        } catch (Exception e) {
            error(e);
            error(e);
            return error(-1, "查询失败");
            return error(-1, "查询失败");