Prechádzať zdrojové kódy

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

Conflicts:
	patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
liuwenbin 7 rokov pred
rodič
commit
e041124429
35 zmenil súbory, kde vykonal 817 pridanie a 269 odobranie
  1. 159 116
      common/common-entity/src/main/java/com/yihu/wlyy/entity/job/QuartzJobConfig.java
  2. 9 1
      patient-co/patient-co-statistics-es/doc/es/统计新增索引.txt
  3. 10 5
      patient-co/patient-co-statistics-es/pom.xml
  4. 84 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/controller/ExtractDataController.java
  5. 13 4
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/controller/QueryController.java
  6. 6 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/dao/WlyyQuotaResultDao.java
  7. 6 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/SaveHelper.java
  8. 50 4
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/es/ElastricSearchSave.java
  9. 17 5
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentMysqlToEsQuotaJob.java
  10. 87 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/ExtractDataService.java
  11. 1 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  12. 10 5
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/vo/SaveModel.java
  13. 38 0
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/RenewSignDataFilter.java
  14. 1 0
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/SignDataFilter.java
  15. 61 8
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/mycache/CachePool.java
  16. 57 26
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java
  17. 4 4
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignOrgOutServerJob.java
  18. 3 3
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignOrgServerJob.java
  19. 5 4
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignServerJob.java
  20. 3 3
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignTeamOutServerJob.java
  21. 3 3
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignTeamServerJob.java
  22. 4 4
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignTownOutServerJob.java
  23. 3 3
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignTownServerJob.java
  24. 0 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/education/HealthEduArticleDao.java
  25. 71 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticleService.java
  26. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java
  27. 0 38
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  28. 0 26
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  29. 9 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/model/Charge.java
  30. 0 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  31. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduDoctorArticleController.java
  32. 95 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/zysoft/ZyHealthEduArticleController.java
  33. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/HealthServiceController.java
  34. 2 0
      patient-co/patient-co-wlyy/src/main/resources/wechat/readMe.MD
  35. 1 1
      patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_jimei.txt

+ 159 - 116
common/common-entity/src/main/java/com/yihu/wlyy/entity/job/QuartzJobConfig.java

@ -1,127 +1,170 @@
package com.yihu.wlyy.entity.job;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
/**
 * 计划任务
 */
@Entity
@Table(name = "wlyy_job_config")
@Table(name = "wlyy_job_config_cwd")
public class QuartzJobConfig implements java.io.Serializable {
	private String id;
	private String quotaId;//指标id
	private String jobName;//任务名称
	private String jobInfo;//任务描述
	private String jobType;//任务类型(0--单次执行  1--周期执行 2--监听任务)
	private String jobClass;//任务执行的class
	private String quartzCron;//quartz表达式
	private String status;//1 启动 0停止
	private String del;//是否删除 1正常 0删除
	/** minimal constructor */
	public QuartzJobConfig() {
	}
	/** full constructor */
	public QuartzJobConfig(String jobName, String jobInfo, String jobType,
						   String jobClass, String quartzCron, String status) {
		this.jobName = jobName;
		this.jobInfo = jobInfo;
		this.jobType = jobType;
		this.jobClass = jobClass;
		this.quartzCron = quartzCron;
		this.status = status;
	}
	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false, length = 50)
	public String getId() {
		return this.id;
	}
	public void setId(String id) {
		this.id = id;
	}
	@Column(name = "job_name", length = 50)
	public String getJobName() {
		return this.jobName;
	}
	public void setJobName(String jobName) {
		this.jobName = jobName;
	}
	@Column(name = "job_info", length = 200)
	public String getJobInfo() {
		return this.jobInfo;
	}
	public void setJobInfo(String jobInfo) {
		this.jobInfo = jobInfo;
	}
	@Column(name = "job_type", length = 10)
	public String getJobType() {
		return this.jobType;
	}
	public void setJobType(String jobType) {
		this.jobType = jobType;
	}
	@Column(name = "job_class", length = 200)
	public String getJobClass() {
		return jobClass;
	}
	public void setJobClass(String jobClass) {
		this.jobClass = jobClass;
	}
	@Column(name = "quartz_cron", length = 200)
	public String getQuartzCron() {
		return this.quartzCron;
	}
	public void setQuartzCron(String quartzCron) {
		this.quartzCron = quartzCron;
	}
	@Column(name = "status", length = 1)
	public String getStatus() {
		return this.status;
	}
	public void setStatus(String status) {
		this.status = status;
	}
	@Column(name = "quota_id", length = 50)
	public String getQuotaId() {
		return quotaId;
	}
	public void setQuotaId(String quotaId) {
		this.quotaId = quotaId;
	}
	@Column(name = "del", length = 1)
	public String getDel() {
		return del;
	}
	public void setDel(String del) {
		this.del = del;
	}
    private String id;
    private String quotaId;//指标id
    private String jobName;//任务名称
    private String jobInfo;//任务描述
    private String jobType;//任务类型(0--单次执行  1--周期执行 2--监听任务)
    private String jobClass;//任务执行的class
    private String quartzCron;//quartz表达式
    private String status;//1 启动 0停止
    private String del;//是否删除 1正常 0删除
    private String sql;
    private String sqlCount;
    private String sqlDay;
    private String sqlYear;
    private String cacheKey;//缓存的key
    /** minimal constructor */
    public QuartzJobConfig() {
    }
    /** full constructor */
    public QuartzJobConfig(String jobName, String jobInfo, String jobType,
                           String jobClass, String quartzCron, String status) {
        this.jobName = jobName;
        this.jobInfo = jobInfo;
        this.jobType = jobType;
        this.jobClass = jobClass;
        this.quartzCron = quartzCron;
        this.status = status;
    }
    // Property accessors
    @GenericGenerator(name = "generator", strategy = "uuid")
    @Id
    @GeneratedValue(generator = "generator")
    @Column(name = "id", unique = true, nullable = false, length = 50)
    public String getId() {
        return this.id;
    }
    public void setId(String id) {
        this.id = id;
    }
    @Column(name = "job_name", length = 50)
    public String getJobName() {
        return this.jobName;
    }
    public void setJobName(String jobName) {
        this.jobName = jobName;
    }
    @Column(name = "job_info", length = 200)
    public String getJobInfo() {
        return this.jobInfo;
    }
    public void setJobInfo(String jobInfo) {
        this.jobInfo = jobInfo;
    }
    @Column(name = "job_type", length = 10)
    public String getJobType() {
        return this.jobType;
    }
    public void setJobType(String jobType) {
        this.jobType = jobType;
    }
    @Column(name = "job_class", length = 200)
    public String getJobClass() {
        return jobClass;
    }
    public void setJobClass(String jobClass) {
        this.jobClass = jobClass;
    }
    @Column(name = "quartz_cron", length = 200)
    public String getQuartzCron() {
        return this.quartzCron;
    }
    public void setQuartzCron(String quartzCron) {
        this.quartzCron = quartzCron;
    }
    @Column(name = "status", length = 1)
    public String getStatus() {
        return this.status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Column(name = "quota_id", length = 50)
    public String getQuotaId() {
        return quotaId;
    }
    public void setQuotaId(String quotaId) {
        this.quotaId = quotaId;
    }
    @Column(name = "del", length = 1)
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public String getSql() {
        return sql;
    }
    public void setSql(String sql) {
        this.sql = sql;
    }
    public String getSqlCount() {
        return sqlCount;
    }
    public void setSqlCount(String sqlCount) {
        this.sqlCount = sqlCount;
    }
    public String getSqlDay() {
        return sqlDay;
    }
    public void setSqlDay(String sqlDay) {
        this.sqlDay = sqlDay;
    }
    public String getSqlYear() {
        return sqlYear;
    }
    public void setSqlYear(String sqlYear) {
        this.sqlYear = sqlYear;
    }
    public String getCacheKey() {
        return cacheKey;
    }
    public void setCacheKey(String cacheKey) {
        this.cacheKey = cacheKey;
    }
}

+ 9 - 1
patient-co/patient-co-statistics-es/doc/es/统计新增索引.txt

@ -97,4 +97,12 @@ POST http://172.19.103.68:9200/wlyy_quota_test/wlyy_quota_test/_mapping
                }
            }
        }
  }
  }
增加索引搜索大小
PUT  http://172.19.103.68:9200/wlyy_quota_test/_settings
{
  "index": {
    "max_result_window": 500000
  }
}

+ 10 - 5
patient-co/patient-co-statistics-es/pom.xml

@ -388,11 +388,11 @@
            <artifactId>spring-boot-starter-mail</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>1.3.5</version>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>de.codecentric</groupId>-->
            <!--<artifactId>spring-boot-admin-starter-client</artifactId>-->
            <!--<version>1.3.5</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
@ -449,6 +449,11 @@
            <groupId>com.yihu</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.17</version>
        </dependency>
    </dependencies>
    <build>

+ 84 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/controller/ExtractDataController.java

@ -0,0 +1,84 @@
package com.yihu.wlyy.statistics.controller;
import com.yihu.wlyy.statistics.service.ExtractDataService;
import com.yihu.wlyy.statistics.vo.SaveModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * Created by chenweida on 2017/10/16.
 */
@RestController
@RequestMapping("/extractData")
@Api(description = "抽取mysql数据到es")
public class ExtractDataController extends BaseController {
    @Autowired
    private ExtractDataService extractDataService;
    @ApiOperation(value = "从mysql抽取某一天的全部指标数据到ES")
    @RequestMapping(value = "/extractOneDate", method = RequestMethod.POST)
    public String extractOneDate(
            @ApiParam(name = "date", value = "时间(yyyy-MM-dd)", required = true) @RequestParam(value = "date", required = true) String date) {
        try {
            extractDataService.extractOneDate(date);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    @ApiOperation(value = "从mysql抽取某一天的某一个指标数据到ES")
    @RequestMapping(value = "/extractOneDateWithId", method = RequestMethod.POST)
    public String extractOneDateWithId(
            @ApiParam(name = "date", value = "时间(yyyy-MM-dd)", required = true) @RequestParam(value = "date", required = true) String date,
            @ApiParam(name = "quotaId", value = "指标ID", required = true) @RequestParam(value = "quotaId", required = true) String quotaId) {
        try {
            extractDataService.extractOneDateWithId(date,quotaId);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    @ApiOperation(value = "从mysql抽取某一天到某一天的全部指标数据到ES")
    @RequestMapping(value = "/extractDate2Date", method = RequestMethod.POST)
    public String extractDate2Date(
            @ApiParam(name = "startDate", value = "开始时间包含头(yyyy-MM-dd)", required = true) @RequestParam(value = "startDate", required = true) String startDate,
            @ApiParam(name = "endDate", value = "结束时间包含尾(yyyy-MM-dd)", required = true) @RequestParam(value = "endDate", required = true) String endDate) {
        try {
            extractDataService.extractDate2Date(startDate,endDate);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
    @ApiOperation(value = "从mysql抽取某一天到某一天的某一个指标数据到ES")
    @RequestMapping(value = "/extractDate2DateWithId", method = RequestMethod.POST)
    public String extractDate2DateWithId(
            @ApiParam(name = "startDate", value = "开始时间包含头(yyyy-MM-dd)", required = true) @RequestParam(value = "startDate", required = true) String startDate,
            @ApiParam(name = "endDate", value = "结束时间包含尾(yyyy-MM-dd)", required = true) @RequestParam(value = "endDate", required = true) String endDate,
            @ApiParam(name = "quotaId", value = "指标ID", required = true) @RequestParam(value = "quotaId", required = true) String quotaId) {
        try {
            extractDataService.extractDate2DateWithId(startDate,endDate,quotaId);
            return success("启动成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "启动失败:" + e.getMessage());
        }
    }
}

+ 13 - 4
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/controller/QueryController.java

@ -47,9 +47,18 @@ public class QueryController {
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    @ApiOperation(value = "执行sql")
    @RequestMapping(value = "/excuteSQL", method = RequestMethod.GET)
    public List<SaveModel> excuteSQL(
            @ApiParam(name = "sql", value = "执行的", required = true) @RequestParam(value = "sql", required = true) String sql) {
        List<SaveModel> saveModels = elasticsearchUtil.excute(sql);
        return saveModels;
    }
    @ApiOperation(value = "查询某几个指标某个层级的列表")
    @RequestMapping(value = "/getQuotasList", method = RequestMethod.GET)
    public Map<String,List<SaveModel>> getQuotasList(
    public Map<String, List<SaveModel>> getQuotasList(
            @ApiParam(name = "ids", value = "指标id,多个逗号分割", required = true) @RequestParam(value = "ids", required = true) String ids,
            @ApiParam(name = "code", value = "指标的code", required = true) @RequestParam(value = "code", required = true) String code,
            @ApiParam(name = "arealevel", value = "指标的level(1 省 2 市 3 区县 4 机构 5团队)", required = true) @RequestParam(value = "arealevel", required = true) String arealevel,
@ -60,7 +69,7 @@ public class QueryController {
        if (StringUtils.isEmpty(date)) {
            date = DateUtil.dateToStrShort(new Date());
        }
        Map<String,List<SaveModel>> jo = new HashMap<>();
        Map<String, List<SaveModel>> jo = new HashMap<>();
        for (String id : ids.split(",")) {
            jo.put("index_" + id, elasticsearchUtil.findOneDateQuotaByChllevel(id, code, date, timeLevel, arealevel, childrenArealevel));
        }
@ -123,12 +132,12 @@ public class QueryController {
    @ApiOperation(value = "查询某几个指标的到达量")
    @RequestMapping(value = "/getQuotas", method = RequestMethod.GET)
    public Map<String,List<SaveModel>> getQuotas(
    public Map<String, List<SaveModel>> getQuotas(
            @ApiParam(name = "ids", value = "指标id,多个逗号分割", required = true) @RequestParam(value = "ids", required = true) String ids,
            @ApiParam(name = "code", value = "指标的code", required = true) @RequestParam(value = "code", required = true) String code,
            @ApiParam(name = "arealevel", value = "指标的level(1 省 2 市 3 区县 4 机构 5团队)", required = true) @RequestParam(value = "arealevel", required = true) String arealevel,
            @ApiParam(name = "date", value = "时间(yyyy-MM-dd),不传默认查今天", required = false) @RequestParam(value = "date", required = false) String date) {
        Map<String,List<SaveModel>> returnMap=new HashMap<>();
        Map<String, List<SaveModel>> returnMap = new HashMap<>();
        for (String id : ids.split(",")) {
            returnMap.put("index_" + id, elasticsearchUtil.findOneDateQuota(id, code, date, "2", arealevel));
        }

+ 6 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/dao/WlyyQuotaResultDao.java

@ -21,4 +21,10 @@ public interface WlyyQuotaResultDao extends PagingAndSortingRepository<WlyyQuota
    @Query(" FROM WlyyQuotaResult a WHERE a.level1Type =?1 and a.qkdoctorJobName != ?2 and a.quatoCode=1")
    List<WlyyQuotaResult> findByLevel1TypeAndQkdoctorJobName(String level1Type, String qkdoctorJobName);
    @Query(" FROM WlyyQuotaResult a WHERE a.quotaDate =?1 and a.level1Type = 1  and a.quatoCode !=18 and a.quatoCode !=19")
    List<WlyyQuotaResult> findByDate(String date);
    @Query(" FROM WlyyQuotaResult a WHERE a.quotaDate =?1 and a.quatoCode=?2  and a.level1Type = 1 and a.quatoCode !=18 and a.quatoCode !=19 ")
    List<WlyyQuotaResult> findByDateAndId(String date, String quotaId);
}

+ 6 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/SaveHelper.java

@ -21,5 +21,11 @@ public class SaveHelper {
        return SpringUtil.getBean(ElastricSearchSave.class).save(sms);
    }
    public Boolean update(List<SaveModel> sms) {
        return SpringUtil.getBean(ElastricSearchSave.class).update(sms);
    }
}

+ 50 - 4
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/es/ElastricSearchSave.java

@ -1,11 +1,13 @@
package com.yihu.wlyy.statistics.etl.save.es;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.statistics.vo.SaveModel;
import io.searchbox.client.JestClient;
import io.searchbox.client.JestResult;
import io.searchbox.core.Bulk;
import io.searchbox.core.BulkResult;
import io.searchbox.core.Index;
import net.sf.json.JSONObject;
import io.searchbox.core.Update;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -38,14 +40,24 @@ public class ElastricSearchSave {
            //得到链接
            JestClient jestClient = elasticFactory.getJestClient();
            int success = 0;
            int error = 0;
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (SaveModel obj : sms) {
                Index index = new Index.Builder(obj).build();
                bulk.addAction(index);
                try {
                    obj.setCreateTime(new Date());
                    Index index = new Index.Builder(obj).build();
                    success++;
                    bulk.addAction(index);
                } catch (Exception e) {
                    logger.error(e.getMessage());
                    error++;
                }
            }
            BulkResult br = jestClient.execute(bulk.build());
            logger.info("save data count:" + sms.size());
            logger.info("save flag:" + br.isSucceeded());
            logger.info("save success:" + success);
            logger.info("save error:" + error);
            return br.isSucceeded();
        } catch (Exception e) {
            logger.error(" save error :" + e.getMessage());
@ -53,4 +65,38 @@ public class ElastricSearchSave {
        return null;
    }
    public Boolean update(List<SaveModel> sms) {
        try {
            //得到链接
            JestClient jestClient = elasticFactory.getJestClient();
            int success = 0;
            int error = 0;
            boolean isSuccessed = true;
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (SaveModel obj : sms) {
                try {
                    JSONObject jo=new JSONObject();
                    obj.setCreateTime(new Date());
                    jo.put("doc",obj);
                    Update index = new Update.Builder(jo.toString()).index(esIndex).type(esType).id(obj.getId()).build();
                    bulk.addAction(index);
                    success++;
                } catch (Exception e) {
                    error++;
                    isSuccessed = false;
                }
            }
            BulkResult br = jestClient.execute(bulk.build());
            logger.info("update flag:" + br.isSucceeded());
            logger.info("update success:" + success);
            logger.info("update error:" + error);
            return isSuccessed;
        } catch (Exception e) {
            logger.error(" update error :" + e.getMessage());
        }
        return null;
    }
}

+ 17 - 5
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentMysqlToEsQuotaJob.java

@ -117,7 +117,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
        if ("2".equals(timeLevel)) {
            //按年度到达量
            startTime = this.year + "-06-30 17:00:00";
        }else{
        } else {
            //增量
            this.startTime = new LocalDate(new DateTime().minusDays(1)).toString("yyyy-MM-dd") + " 17:00:00"; //2017-06-01 17:00:00
        }
@ -136,7 +136,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
        List<QuartzJobConfig> list = quartzJobConfigDao.findByIds();
        list.stream().forEach(one -> {
            try {
                logger.info("========================quotaCode:" + one.getId() + ","+DateUtil.dateToStr(quotaDate, "yyyy-MM-dd")+",timeLevel:"+timeLevel+" start========================");
                logger.info("========================quotaCode:" + one.getId() + "," + DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + ",timeLevel:" + timeLevel + " start========================");
                QuartzJobLog tjQuotaLog = new QuartzJobLog();
                tjQuotaLog.setJobId(one.getId());
                tjQuotaLog.setJobStartTime(new Date());
@ -160,7 +160,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
                tjQuotaLog.setJobEndTime(new Date());
                tjQuotaLog.setJobContent(JSONArray.fromObject(filterModel.getErrorModels()).toString());
                saveLog(tjQuotaLog);
                logger.info("========================quotaCode:" + one.getId() + ","+DateUtil.dateToStr(quotaDate, "yyyy-MM-dd")+" start========================");
                logger.info("========================quotaCode:" + one.getId() + "," + DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + " start========================");
            } catch (Exception e) {
                e.printStackTrace();
            }
@ -205,16 +205,28 @@ public class CurrentMysqlToEsQuotaJob implements Job {
                    SaveModel newResult = smsMap.get(obj.getTeam());
                    obj.setResult1(newResult.getResult1());
                    obj.setResult2(newResult.getResult2());
                    obj.setCreateTime(new Date());
                }
                sms=quarySaveModels;
                sms = quarySaveModels;
                return updateDate(sms);
            } else {
                return saveDate(sms);
            }
            return saveDate(sms);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }
    private boolean updateDate(List<SaveModel> sms) {
        try {
            return SpringUtil.getBean(SaveHelper.class).update(sms);
        } catch (Exception e) {
            logger.error("save error:" + e.getMessage());
        }
        return false;
    }
    @Transactional
    private void saveLog(QuartzJobLog tjQuotaLog) {
        quartzJobLogDao.save(tjQuotaLog);

+ 87 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/ExtractDataService.java

@ -0,0 +1,87 @@
package com.yihu.wlyy.statistics.service;
import com.yihu.wlyy.entity.statistics.WlyyQuotaResult;
import com.yihu.wlyy.statistics.dao.WlyyQuotaResultDao;
import com.yihu.wlyy.statistics.etl.save.es.ElastricSearchSave;
import com.yihu.wlyy.statistics.vo.SaveModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/10/16.
 */
@Service
public class ExtractDataService {
    @Autowired
    private WlyyQuotaResultDao wlyyQuotaResultDao;
    @Autowired
    private ElastricSearchSave elastricSearchSave;
    public void extractOneDate(String date) {
        List<WlyyQuotaResult> quotaResults = wlyyQuotaResultDao.findByDate(date);
        List<SaveModel> saveModel = new ArrayList<>();
        if (quotaResults != null && quotaResults.size() > 0) {
            quotaResults.stream().forEach(one -> {
                SaveModel saveModelTemp = new SaveModel();
                saveModelTemp.setQuotaCode(one.getQuatoCode());
                saveModelTemp.setQuotaDate(one.getQuotaDate());
                saveModelTemp.setCreateTime(one.getCreateTime());
                saveModelTemp.setCity(one.getCity());
                saveModelTemp.setCityName(one.getCityName());
                saveModelTemp.setTown(one.getTown());
                saveModelTemp.setTownName(one.getTownName());
                saveModelTemp.setHospital(one.getOrgCode());
                saveModelTemp.setHospitalName(one.getOrgName());
                saveModelTemp.setTeam(one.getQkdoctorCode());
                saveModelTemp.setTeamName(one.getQkdoctorName());
                saveModelTemp.setResult1(Integer.valueOf(one.getResult()));
                saveModelTemp.setResult2(Integer.valueOf(one.getResult()));
                saveModelTemp.setSlaveKey1(one.getLevel2Type());
                saveModelTemp.setSlaveKey1Name(one.getLevel2TypeName());
                saveModelTemp.setSlaveKey2(one.getLevel3Type());
                saveModelTemp.setSlaveKey2Name(one.getLevel3TypeName());
                if (
                        "1".equals(one.getQuatoCode()) ||
                        "2".equals(one.getQuatoCode()) ||
                        "6".equals(one.getQuatoCode())||
                                "7".equals(one.getQuatoCode())||
                                "8".equals(one.getQuatoCode())||
                                "9".equals(one.getQuatoCode())
                   ){
                    saveModelTemp.setTimeLevel("2");
                }
                if (
                        "3".equals(one.getQuatoCode()) ||
                        "4".equals(one.getQuatoCode()) ||
                        "5".equals(one.getQuatoCode())
                        ){
                    saveModelTemp.setTimeLevel("2");
                }
                saveModelTemp.setAreaLevel("5");
            });
        }
    }
    public void extractOneDateWithId(String date, String quotaId) {
        wlyyQuotaResultDao.findByDateAndId(date, quotaId);
    }
    public void extractDate2Date(String startDate, String endDate) {
    }
    public void extractDate2DateWithId(String startDate, String endDate, String quotaId) {
    }
}

+ 1 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -127,6 +127,7 @@ public class JobService {
            //往quartz框架添加任务
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                Thread.sleep(sleepTime);
            }
        }
    }

+ 10 - 5
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/vo/SaveModel.java

@ -1,10 +1,12 @@
package com.yihu.wlyy.statistics.vo;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.searchbox.annotations.JestId;
import org.elasticsearch.index.analysis.AnalysisSettingsRequired;
import org.springframework.data.annotation.CreatedDate;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@ -18,9 +20,9 @@ public class SaveModel {
    private final static String townKey = "town";
    private final static String cityKey = "city";
    public final static String interval_day="1";
    public final static String interval_week="2";
    public final static String interval_month="3";
    public final static String interval_day = "1";
    public final static String interval_week = "2";
    public final static String interval_month = "3";
    public final static String teamLevel = "5";
    public final static String OrgLevel = "4";
@ -35,6 +37,9 @@ public class SaveModel {
    private String quotaCode;//指标code
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ssXX")
    @CreatedDate
    @JSONField(format = "yyyy-MM-dd'T'HH:mm:ssXX")
    private Date quotaDate;//统计时间
    private String city;//城市代码 350200
@ -74,13 +79,13 @@ public class SaveModel {
    private Integer result2 = 0;//统计结果  次数
    private String areaLevel;// 1 省 2 市 3 区县 4 机构 5团队
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd'T'HHmmss.SSS'Z'")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ssXX")
    @CreatedDate
    @JSONField(format = "yyyy-MM-dd'T'HH:mm:ssXX")
    private Date createTime;//创建时间
    private String timeLevel;// 1日 2年
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy/MM/dd ")
    public Date getQuotaDate() {
        return quotaDate;
    }

+ 38 - 0
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/RenewSignDataFilter.java

@ -309,11 +309,49 @@ public class RenewSignDataFilter {
                case "2": {
                    return getServerType(signFamily);
                }
                case "3": {
                    return getRenewAgeDisease(signFamily);
                }
            }
        }
        return returnLevel2Key;
    }
    private String getRenewAgeDisease(SignFamilyRenew signFamily) {
        //得到患者年龄
        StringBuffer returnLevel2KeyBuffer = new StringBuffer("0");
        //原来是身份证解析年龄,现在根据患者分组
        String group = cachePool.getPatientGroup(signFamily.getPatient());
        if ("3".equals(group)) {
            returnLevel2KeyBuffer.append(",3");
        }
        //疾病标签
        String returnLevel2KeyTemp = "";
        boolean hasGXY = false;//有高血压
        boolean hasTNB = false;//糖尿病
        //得到患者的疾病标签
        List<String> diseaseList = cachePool.getDiseaseGroup(signFamily.getPatient());
        if (diseaseList != null && diseaseList.size() > 0) {
            for (String diseaseCode : diseaseList) {
                if ("1".equals(diseaseCode)) {//判斷是否有高血壓
                    returnLevel2KeyTemp = "1";
                    hasGXY = true;
                }
                if ("2".equals(diseaseCode)) {//判斷是否有糖尿病
                    returnLevel2KeyTemp = "2";
                    hasTNB = true;
                }
            }
        }
        if (hasTNB && hasGXY) {
            returnLevel2KeyTemp = "1,2";
        }
        if (!StringUtils.isEmpty(returnLevel2KeyTemp)) {
            returnLevel2KeyBuffer.append("," + returnLevel2KeyTemp);
        }
        return returnLevel2KeyBuffer.toString();
    }
    private String getReason(SignFamilyRenew signFamily) {
        return signFamily.getRenewChangeReason();
    }

+ 1 - 0
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/dataFilter/SignDataFilter.java

@ -11,6 +11,7 @@ import com.yihu.wlyy.statistics.etl.mycache.CachePool;
import com.yihu.wlyy.statistics.job.business.Constant;
import com.yihu.wlyy.statistics.model.hosptial.Hospital;
import com.yihu.wlyy.statistics.model.signfamily.SignFamily;
import com.yihu.wlyy.statistics.model.signfamily.SignFamilyRenew;
import com.yihu.wlyy.statistics.model.system.Town;
import com.yihu.wlyy.statistics.model.team.AdminTeam;
import com.yihu.wlyy.statistics.util.DateUtil;

+ 61 - 8
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/mycache/CachePool.java

@ -79,6 +79,10 @@ public class CachePool {
     * 疾病标签的缓存 key 是患者code
     */
    private static Map<String, List<String>> diseaseGroup = new HashMap<String, List<String>>();
    /**
     * 疾病标签的缓存 key 是患者code
     */
    private static Map<String, List<String>> renewDiseaseGroup = new HashMap<String, List<String>>();
    /**
     * 某天的签约的已扣费的到达量
@ -224,6 +228,34 @@ public class CachePool {
        }
    }
    private synchronized void initRenewDiseaseGroup() throws Exception {
        if (renewDiseaseGroup.size() == 0) {
            String sql = "SELECT " +
                    " l.patient, " +
                    " l.label, " +
                    " p.idcard " +
                    " FROM " +
                    " wlyy_sign_patient_label_info l " +
                    " LEFT JOIN wlyy_patient p ON l.patient = p.`code` " +
                    " WHERE " +
                    " l.label_type = '3' " +
                    " AND l. STATUS = 1";
            String countSql = "select count(id) from wlyy_sign_patient_label_info where label_type='3' and status=1";
            List<SignPatientLabelInfo> signPatientLabelInfoList = SpringUtil.getBean(DBExtract.class).extractByPage(SignPatientLabelInfo.class, sql, countSql, true);
            for (SignPatientLabelInfo signPatientLabelInfo : signPatientLabelInfoList) {
                if (renewDiseaseGroup.containsKey(signPatientLabelInfo.getPatient())) {
                    List<String> code = renewDiseaseGroup.get(signPatientLabelInfo.getPatient());
                    code.add(signPatientLabelInfo.getLabel());
                    renewDiseaseGroup.put(signPatientLabelInfo.getPatient(), code);
                } else {
                    List<String> code = new ArrayList<>();
                    code.add(signPatientLabelInfo.getLabel());
                    renewDiseaseGroup.put(signPatientLabelInfo.getPatient(), code);
                }
            }
        }
    }
    public static void cleanAllCache() {
        arriveSignFamilyExpenseStatus1Map.clear();
        patientGroup.clear();
@ -303,7 +335,10 @@ public class CachePool {
        if (model == null) {
            model = new RenewCacheModel();
            String sql=" select fr.sign_code code,fr.hospital ,fr.admin_team_id  from wlyy_sign_family_renew_log fr where " +
            String sql=" select fr.sign_code code,fr.hospital ,fr.admin_team_id ,p.`code` patient " +
                    "   from wlyy_sign_family_renew_log fr " +
                    "   join wlyy_patient p ON p.idcard = fr.idcard" +
                    "   where " +
                    "   fr.apply_date<'"+ date + Constant.quota_date_last+"' " +
                    "   and fr.sign_year ='"+Constant.getNowYearByDate(date)+"' " +
                    "   and LENGTH(fr.hospital)=10 " +
@ -332,7 +367,10 @@ public class CachePool {
        if (model == null) {
            model = new RenewCacheModel();
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id from wlyy_sign_family_renew_log fr where " +
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,p.`code` patient " +
                    "  from wlyy_sign_family_renew_log fr " +
                    "  join wlyy_patient p ON p.idcard = fr.idcard" +
                    "  where " +
                    "  fr.apply_date<'"+ date + Constant.quota_date_last+"' " +
                    "  and fr.sign_year ='"+Constant.getNowYearByDate(date)+"'   " +
                    "  and LEFT(fr.hospital,6)=LEFT(fr.old_hospital,6) " +
@ -361,8 +399,11 @@ public class CachePool {
        if (model == null) {
            model = new RenewCacheModel();
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id from wlyy_sign_family_renew_log fr where " +
                    "   fr.apply_date<'"+date+ Constant.quota_date_last+"' " +
            String sql="select fr.sign_code code,fr.hospital,fr.admin_team_id ,p.`code` patient " +
                    "  from wlyy_sign_family_renew_log fr " +
                    "  join wlyy_patient p ON p.idcard = fr.idcard" +
                    "  where " +
                    "  fr.apply_date<'"+date+ Constant.quota_date_last+"' " +
                    "  and fr.sign_year ='"+Constant.getNowYearByDate(date)+"'  " +
                    "  and fr.hospital=fr.old_hospital " +
                    "  and LENGTH(fr.hospital)=10 " +
@ -390,7 +431,10 @@ public class CachePool {
        if (model == null) {
            model = new RenewCacheModel();
            String sql=" select fr.sign_code code,fr.hospital ,fr.admin_team_id  from wlyy_sign_family_renew_log fr where " +
            String sql=" select fr.sign_code code,fr.hospital ,fr.admin_team_id ,p.`code` patient " +
                    "   from wlyy_sign_family_renew_log fr " +
                    "   join wlyy_patient p ON p.idcard = fr.idcard" +
                    "   where " +
                    "   fr.apply_date<'"+ date + Constant.quota_date_last+"' " +
                    "   and fr.sign_year ='"+Constant.getNowYearByDate(date)+"' " +
                    "   and fr.admin_team_id=fr.old_admin_team_id " +
@ -420,7 +464,10 @@ public class CachePool {
        if (model == null) {
            model = new RenewCacheModel();
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id from wlyy_sign_family_renew_log fr where " +
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,p.`code` patient " +
                    "  from wlyy_sign_family_renew_log fr " +
                    "  join wlyy_patient p ON p.idcard = fr.idcard" +
                    "  where " +
                    "  fr.apply_date<'"+ date + Constant.quota_date_last+"'" +
                    "   and fr.sign_year ='"+Constant.getNowYearByDate(date)+"'" +
                    "   and fr.admin_team_id!=fr.old_admin_team_id " +
@ -450,7 +497,10 @@ public class CachePool {
        if (model == null) {
            model = new RenewCacheModel();
            String sql="select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id from wlyy_sign_family_renew_log fr where " +
            String sql="select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,p.`code` patient " +
                    "  from wlyy_sign_family_renew_log fr " +
                    "  join wlyy_patient p ON p.idcard = fr.idcard" +
                    "  where " +
                    "  fr.apply_date<'"+date+ Constant.quota_date_last+"' " +
                    "  and fr.sign_year ='"+Constant.getNowYearByDate(date)+"'" +
                    "  and fr.hospital!=fr.old_hospital" +
@ -480,7 +530,10 @@ public class CachePool {
        if (model == null) {
            model = new RenewCacheModel();
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id from wlyy_sign_family_renew_log fr where " +
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,p.`code` patient  " +
                    "  from wlyy_sign_family_renew_log fr " +
                    "  join wlyy_patient p ON p.idcard = fr.idcard" +
                    "  where " +
                    "  fr.apply_date<'"+ date + Constant.quota_date_last+"' " +
                    "  and fr.sign_year ='"+Constant.getNowYearByDate(date)+"'" +
                    "  and LEFT(fr.hospital,6)!=LEFT(fr.old_hospital,6)  " +

+ 57 - 26
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java

@ -147,7 +147,10 @@ public class CurrentDayAllQuotaJob implements Job {
     */
    public Map<String,Object> getCityRenewTotals(){
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id from wlyy_sign_family_renew_log fr where  " +
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,p.`code` patient " +
                    " from wlyy_sign_family_renew_log fr " +
                    " join wlyy_patient p ON p.idcard = fr.idcard" +
                    " where  " +
                    " fr.apply_date<'"+ tomorrow+"' and " +
                    " fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and " +
                    " LENGTH(fr.hospital)=10 and " +
@ -171,7 +174,10 @@ public class CurrentDayAllQuotaJob implements Job {
     */
    public Map<String,Object> getTowmRenewTotals(){
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id from wlyy_sign_family_renew_log fr where  " +
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,p.`code` patient " +
                    " from wlyy_sign_family_renew_log fr " +
                    " join wlyy_patient p ON p.idcard = fr.idcard" +
                    " where  " +
                    " fr.apply_date<'"+ tomorrow+"' and " +
                    " fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and " +
                    " LEFT(fr.hospital,6)=LEFT(fr.old_hospital,6)  and " +
@ -195,7 +201,11 @@ public class CurrentDayAllQuotaJob implements Job {
     */
    public Map<String,Object> getOrgRenewTotals(){
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id from wlyy_sign_family_renew_log fr where   fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "'and  fr.hospital=fr.old_hospital  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,p.`code` patient " +
                    " from wlyy_sign_family_renew_log fr " +
                    " join wlyy_patient p ON p.idcard = fr.idcard" +
                    " where " +
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "'and  fr.hospital=fr.old_hospital  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
            //抽取數據
            List<SignFamilyRenew> signFamilies = SpringUtil.getBean(DBExtract.class).extract(SignFamilyRenew.class, sql);
            Map<String,Object> map = new HashedMap();
@ -214,7 +224,11 @@ public class CurrentDayAllQuotaJob implements Job {
     */
    public Map<String,Object> getTeamRenewTotals(){
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id from wlyy_sign_family_renew_log fr where   fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id=fr.old_admin_team_id  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,p.`code` patient " +
                    " from wlyy_sign_family_renew_log fr " +
                    " join wlyy_patient p ON p.idcard = fr.idcard" +
                    " where   " +
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id=fr.old_admin_team_id  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
            //抽取數據
            List<SignFamilyRenew> signFamilies = SpringUtil.getBean(DBExtract.class).extract(SignFamilyRenew.class, sql);
            Map<String,Object> map = new HashedMap();
@ -229,7 +243,11 @@ public class CurrentDayAllQuotaJob implements Job {
    public Map<String,Object> getTeamRenewOut(){
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id from wlyy_sign_family_renew_log fr where    fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,p.`code` patient " +
                    " from wlyy_sign_family_renew_log fr " +
                    " join wlyy_patient p ON p.idcard = fr.idcard " +
                    " where    " +
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
            //抽取數據
            List<SignFamilyRenew> signFamilies = SpringUtil.getBean(DBExtract.class).extract(SignFamilyRenew.class, sql);
            Map<String,Object> map = new HashedMap();
@ -244,7 +262,11 @@ public class CurrentDayAllQuotaJob implements Job {
    public Map<String,Object> getOrgRenewOut(){
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id from wlyy_sign_family_renew_log fr where   fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,p.`code` patient " +
                    " from wlyy_sign_family_renew_log fr " +
                    " join wlyy_patient p ON p.idcard = fr.idcard" +
                    " where   " +
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
            //抽取數據
            List<SignFamilyRenew> signFamilies = SpringUtil.getBean(DBExtract.class).extract(SignFamilyRenew.class, sql);
            Map<String,Object> map = new HashedMap();
@ -259,7 +281,11 @@ public class CurrentDayAllQuotaJob implements Job {
    public Map<String,Object> getTownRenewOut(){
        try{
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id from wlyy_sign_family_renew_log fr where   fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LEFT(fr.hospital,6)!=LEFT(fr.old_hospital,6)  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
            String sql=" select fr.sign_code code,fr.old_hospital hospital,fr.old_admin_team_id admin_team_id ,p.`code` patient " +
                    " from wlyy_sign_family_renew_log fr " +
                    " join wlyy_patient p ON p.idcard = fr.idcard " +
                    " where " +
                    " fr.apply_date<'"+ tomorrow+"' and  fr.sign_year= '" + Constant.getNowYearByDate(tomorrow) + "' and fr.admin_team_id!=fr.old_admin_team_id and fr.hospital!=fr.old_hospital and LEFT(fr.hospital,6)!=LEFT(fr.old_hospital,6)  and LENGTH(fr.hospital)=10 and LENGTH(fr.old_hospital)=10 ";
            //抽取數據
            List<SignFamilyRenew> signFamilies = SpringUtil.getBean(DBExtract.class).extract(SignFamilyRenew.class, sql);
            Map<String,Object> map = new HashedMap();
@ -302,9 +328,9 @@ public class CurrentDayAllQuotaJob implements Job {
        Map<String,Object>  orgSignFamilies =getOrgRenewTotals();
        Map<String,Object>  teamSignFamilies =getTeamRenewTotals();
        //数据抽取迁出率
        Map<String,Object>  townSignOutFamilies =getTowmRenewTotals();
        Map<String,Object>  orgSignOutFamilies =getOrgRenewTotals();
        Map<String,Object>  teamSignOutFamilies =getTeamRenewTotals();
        Map<String,Object>  townSignOutFamilies =getTownRenewOut();
        Map<String,Object>  orgSignOutFamilies =getOrgRenewOut();
        Map<String,Object>  teamSignOutFamilies =getTeamRenewOut();
@ -352,8 +378,8 @@ public class CurrentDayAllQuotaJob implements Job {
        //computequota_45(); //统计社区转签 没用指标
        //computequota_46(); //统计区转签  没用指标
        computequota_30(); //统计团队续签原因
//        computequota_47(); //统计社区续签原因 没用指标
//        computequota_48(); //统计区续签原因 没用指标
        computequota_47(); //统计社区续签原因 没用指标
        computequota_48(); //统计区续签原因 没用指标
        //1.3.8需求开发
        computequota_51(citySignFamilies);//统计市级续签服务类型维度
@ -1414,13 +1440,13 @@ public class CurrentDayAllQuotaJob implements Job {
            List<SignFamilyRenew> signFamilies = (List<SignFamilyRenew>)sign.get("signFamilies");
            String sql =  (String)sign.get("sql");
            //清洗數據
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies,"2",null,sql,"now");
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies,"3",null,sql,"now");
            //统计数据 一级维度
            List<Map<String, List<ETLModel>>> returnDatas = SpringUtil.getBean(Level1Role.class).elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>> patientSexRoleData = SpringUtil.getBean(Level2Role.class).elt(returnDatas);
            //保存数据
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 12, 10, 0);
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 3, 7,1);
            allContent.append(JsonUtil.objToStr(etlModels.getLogModel()));
        } catch (Exception e) {
            e.printStackTrace();
@ -1629,13 +1655,14 @@ public class CurrentDayAllQuotaJob implements Job {
            List<SignFamilyRenew> signFamilies = (List<SignFamilyRenew>)sign.get("signFamilies");
            String sql =  (String)sign.get("sql");
            //清洗數據
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies,"2",null ,sql, "now");
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies,"3",null ,sql, "now");
            //统计数据 一级维度
            List<Map<String, List<ETLModel>>> returnDatas = SpringUtil.getBean(Level1Role.class).elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>> patientSexRoleData = SpringUtil.getBean(Level2Role.class).elt(returnDatas);
            //保存数据
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 12, 10, 0);
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 3, 7,1);
            allContent.append(JsonUtil.objToStr(etlModels.getLogModel()));
        } catch (Exception e) {
            e.printStackTrace();
@ -1700,13 +1727,14 @@ public class CurrentDayAllQuotaJob implements Job {
//            //抽取數據
//            List<SignFamilyRenew> signFamilies = SpringUtil.getBean(DBExtract.class).extract(SignFamilyRenew.class, sql);
            //清洗數據
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies,"2",null,sql, "now");
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies,"3",null,sql, "now");
            //统计数据 一级维度
            List<Map<String, List<ETLModel>>> returnDatas = SpringUtil.getBean(Level1Role.class).elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>> patientSexRoleData = SpringUtil.getBean(Level2Role.class).elt(returnDatas);
            //保存数据
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 12, 10, 0);
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 3, 7,1);
            allContent.append(JsonUtil.objToStr(etlModels.getLogModel()));
        } catch (Exception e) {
            e.printStackTrace();
@ -1771,13 +1799,14 @@ public class CurrentDayAllQuotaJob implements Job {
//            //抽取數據
//            List<SignFamilyRenew> signFamilies = SpringUtil.getBean(DBExtract.class).extract(SignFamilyRenew.class, sql);
            //清洗數據
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies,"2",null, sql, "now");
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies,"3",null, sql, "now");
            //统计数据 一级维度
            List<Map<String, List<ETLModel>>> returnDatas = SpringUtil.getBean(Level1Role.class).elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>> patientSexRoleData = SpringUtil.getBean(Level2Role.class).elt(returnDatas);
            //保存数据
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 12, 10, 0);
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 3, 7,1);
            allContent.append(JsonUtil.objToStr(etlModels.getLogModel()));
        } catch (Exception e) {
            e.printStackTrace();
@ -1832,13 +1861,13 @@ public class CurrentDayAllQuotaJob implements Job {
            List<SignFamilyRenew> signFamilies = (List<SignFamilyRenew>)sign.get("signFamilies");
            String sql =  (String)sign.get("sql");
            //清洗數據
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies, "2",null,sql, "now");
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies, "3",null,sql, "now");
            //统计数据 一级维度
            List<Map<String, List<ETLModel>>> returnDatas = SpringUtil.getBean(Level1Role.class).elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>> patientSexRoleData = SpringUtil.getBean(Level2Role.class).elt(returnDatas);
            //保存数据
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 12, 10, 0);
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 3, 7,1);
            allContent.append(JsonUtil.objToStr(etlModels.getLogModel()));
        } catch (Exception e) {
            e.printStackTrace();
@ -1855,13 +1884,14 @@ public class CurrentDayAllQuotaJob implements Job {
//            //抽取數據
//            List<SignFamilyRenew> signFamilies = SpringUtil.getBean(DBExtract.class).extract(SignFamilyRenew.class, sql);
            //清洗數據
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies, "2",null,sql, "now");
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies, "3",null,sql, "now");
            //统计数据 一级维度
            List<Map<String, List<ETLModel>>> returnDatas = SpringUtil.getBean(Level1Role.class).elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>> patientSexRoleData = SpringUtil.getBean(Level2Role.class).elt(returnDatas);
            //保存数据
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 12, 10, 0);
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 3, 7,1);
            allContent.append(JsonUtil.objToStr(etlModels.getLogModel()));
        } catch (Exception e) {
            e.printStackTrace();
@ -1911,13 +1941,14 @@ public class CurrentDayAllQuotaJob implements Job {
            List<SignFamilyRenew> signFamilies = (List<SignFamilyRenew>)sign.get("signFamilies");
            String sql =  (String)sign.get("sql");
            //清洗數據
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies,"2",null,sql,"now");
            FilterModel etlModels = SpringUtil.getBean(RenewSignDataFilter.class).filter(signFamilies,"3",null,sql,"now");
            //统计数据 一级维度
            List<Map<String, List<ETLModel>>> returnDatas = SpringUtil.getBean(Level1Role.class).elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>> patientSexRoleData = SpringUtil.getBean(Level2Role.class).elt(returnDatas);
            //保存数据
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 12, 10, 0);
            SpringUtil.getBean(RedisStorage.class).saveByLevel2(patientSexRoleData, null, quotaId, 3, 7,1);
            allContent.append(JsonUtil.objToStr(etlModels.getLogModel()));
        } catch (Exception e) {
            e.printStackTrace();

+ 4 - 4
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignOrgOutServerJob.java

@ -84,7 +84,7 @@ public class RenewSignOrgOutServerJob implements Job {
    @Transactional
    private void computequota() {
        try{
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+39+"'");
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+56+"'");
            //新建任务日志对象
            QuartzJobLog quartzJobLog = new QuartzJobLog();
@ -95,15 +95,15 @@ public class RenewSignOrgOutServerJob implements Job {
            //抽取數據
            RenewCacheModel cacheModel= cachePool.getArriveRenewSignOrgOutMapByDate(yesterday);
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"2",null,cacheModel.getSql(),yesterday);
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"3",null,cacheModel.getSql(),yesterday);
            //统计数据 1级维度
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>>  level2Data= level2Role.elt(returnDatas);;
            //保存数据
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,12,10,1);
            //dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,12,10,1);
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,3,7,1);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));

+ 3 - 3
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignOrgServerJob.java

@ -85,7 +85,7 @@ public class RenewSignOrgServerJob implements Job {
    @Transactional
    private void computequota() {
        try{
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+43+"'");
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+53+"'");
            //新建任务日志对象
            QuartzJobLog quartzJobLog = new QuartzJobLog();
@ -95,13 +95,13 @@ public class RenewSignOrgServerJob implements Job {
            //从缓存取数据
            RenewCacheModel cacheModel=cachePool.getArriveRenewTotalOrgMapByDate(yesterday);
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"2",null,cacheModel.getSql(),yesterday);
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"3",null,cacheModel.getSql(),yesterday);
            //统计数据 1级维度
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>>  level2Data= level2Role.elt(returnDatas);;
            //保存数据
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,12,10,1);
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,3,7,1);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));

+ 5 - 4
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignServerJob.java

@ -35,7 +35,7 @@ import java.util.Map;
@Component
@Scope("prototype")
@DisallowConcurrentExecution//防止到了执行时间点前一任务还在执行中,但是这时有空闲的线程,那么马上又会执行,这样一来就会存在同一job被并行执行
public class RenewSignServerJob implements Job {
public class  RenewSignServerJob implements Job {
    private WlyyQuotaVO wlyyQuota;//指标对象
    private WlyyJobConfigVO wlyyJobConfig;//配置对象
@ -84,7 +84,7 @@ public class RenewSignServerJob implements Job {
    @Transactional
    private void computequota() {
        try{
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+29+"'");
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+51+"'");
            //新建任务日志对象
            QuartzJobLog quartzJobLog = new QuartzJobLog();
@ -95,13 +95,14 @@ public class RenewSignServerJob implements Job {
            //从缓存取数据
            RenewCacheModel cacheModel=cachePool.getArriveRenewTotalCityMapByDate(yesterday);
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"2",null,cacheModel.getSql(),yesterday);
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"3",null,cacheModel.getSql(),yesterday);
            //统计数据 1级维度
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>>  level2Data= level2Role.elt(returnDatas);;
            //保存数据
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,12,10,1);
            //dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,12,10,1);
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,3,7,1);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));

+ 3 - 3
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignTeamOutServerJob.java

@ -85,7 +85,7 @@ public class RenewSignTeamOutServerJob implements Job {
    @Transactional
    private void computequota() {
        try{
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+35+"'");
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+55+"'");
            //新建任务日志对象
            QuartzJobLog quartzJobLog = new QuartzJobLog();
@ -95,13 +95,13 @@ public class RenewSignTeamOutServerJob implements Job {
            //抽取數據
            RenewCacheModel cacheModel= cachePool.getArriveRenewSignTeamOutMapByDate(yesterday);
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"2",null,cacheModel.getSql(),yesterday);
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"3",null,cacheModel.getSql(),yesterday);
            //统计数据 1级维度
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>>  level2Data= level2Role.elt(returnDatas);;
            //保存数据
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,12,10,1);
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,3,7,1);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));

+ 3 - 3
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignTeamServerJob.java

@ -84,7 +84,7 @@ public class RenewSignTeamServerJob implements Job {
    @Transactional
    private void computequota() {
        try{
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+42+"'");
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+52+"'");
            //新建任务日志对象
            QuartzJobLog quartzJobLog = new QuartzJobLog();
@ -94,13 +94,13 @@ public class RenewSignTeamServerJob implements Job {
            //从缓存取数据
            RenewCacheModel cacheModel=cachePool.getArriveRenewTotalTeamMapByDate(yesterday);
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"2",null,cacheModel.getSql(),yesterday);
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"3",null,cacheModel.getSql(),yesterday);
            //统计数据 1级维度
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>>  level2Data= level2Role.elt(returnDatas);;
            //保存数据
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,12,10,1);
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,3,7,1);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));

+ 4 - 4
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignTownOutServerJob.java

@ -31,7 +31,7 @@ import java.util.List;
import java.util.Map;
/**
 * 续签团队签出服务类型的指标执行类
 * 续签团队签出(标签类型维度)的指标执行类
 */
@Component
@Scope("prototype")
@ -84,7 +84,7 @@ public class RenewSignTownOutServerJob implements Job {
    @Transactional
    private void computequota() {
        try{
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+41+"'");
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+57+"'");
            //新建任务日志对象
            QuartzJobLog quartzJobLog = new QuartzJobLog();
@ -94,13 +94,13 @@ public class RenewSignTownOutServerJob implements Job {
            //抽取數據
            RenewCacheModel cacheModel= cachePool.getArriveRenewSignTownOutMapByDate(yesterday);
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"2",null,cacheModel.getSql(),yesterday);
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"3",null,cacheModel.getSql(),yesterday);
            //统计数据 1级维度
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>>  level2Data= level2Role.elt(returnDatas);;
            //保存数据
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,12,10,1);
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,3,7,1);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));

+ 3 - 3
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/signServer/RenewSignTownServerJob.java

@ -84,7 +84,7 @@ public class RenewSignTownServerJob implements Job {
    @Transactional
    private void computequota() {
        try{
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+44+"'");
            jdbcTemplate.execute("delete from wlyy_quota_result where quota_date='"+yesterday+"' and quato_code='"+54+"'");
            //新建任务日志对象
            QuartzJobLog quartzJobLog = new QuartzJobLog();
@ -94,13 +94,13 @@ public class RenewSignTownServerJob implements Job {
            //从缓存取数据
            RenewCacheModel cacheModel=cachePool.getArriveRenewTotalTeamMapByDate(yesterday);
            //清洗數據
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"2",null,cacheModel.getSql(),yesterday);
            FilterModel etlModels= signDataFilter.filter(cacheModel.getSignFamilies(),"3",null,cacheModel.getSql(),yesterday);
            //统计数据 1级维度
            List<Map<String, List<ETLModel>>>  returnDatas= levelRole.elt(etlModels.getEtlModelList());
            //统计数据 二级维度
            List<Map<String, Map<String, List<ETLModel>>>>  level2Data= level2Role.elt(returnDatas);;
            //保存数据
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,12,10,1);
            dbStorage.saveByLevel2(level2Data,yesterday,wlyyQuota,3,7,1);
            //保存日志
            quartzJobLog.setJobEndTime(new Date());
            quartzJobLog.setJobContent(JsonUtil.objToStr(etlModels.getLogModel()));

+ 0 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/education/HealthEduArticleDao.java

@ -1,6 +1,5 @@
package com.yihu.wlyy.repository.education;
import com.yihu.wlyy.entity.patient.PatientHealthRecordDiet;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
@ -9,7 +8,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import java.util.Date;
public interface HealthEduArticleDao extends PagingAndSortingRepository<HealthEduArticle, Long>, JpaSpecificationExecutor<HealthEduArticle> {

+ 71 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/HealthEduArticleService.java

@ -299,4 +299,75 @@ public class HealthEduArticleService extends BaseService {
        }
    }
    
    public List<Map<String,Object>> zyfindAll(int page, int pagesize, String titlefilter, String keywordfilter, String contentfilter) {
        if (pagesize <= 0) {
            pagesize = 10;
        }
        if (page <=0) {
            page = 1;
        }
        page = page-1;
        List<Object> params = new ArrayList<Object>();
        StringBuffer sql = new StringBuffer();
        sql.append("select a.id,a.code,a.title,a.url,a.czrq,a.summary content,a.keyword");
        sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.code and c.status = 1) as readAmount");
        sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.code and c.status = 2) as collectionAmount");
        sql.append(",(select count(1) from wlyy_health_edu_article_op_history c where c.code = a.code and c.status = 3) as repeatAmount");
        sql.append(" from wlyy_health_edu_article a  ");//内联取文章内容
        String where = " where 1=1 ";
        if (StringUtils.isNotBlank(titlefilter) ||
                StringUtils.isNotBlank(keywordfilter)||
                    StringUtils.isNotBlank(contentfilter)) {
            where += " and  ( ";
            
            boolean need_or = false;
    
            //文章标题关键字搜索
            if(StringUtils.isNotBlank(titlefilter)){
                titlefilter = "%" + titlefilter + "%";
                where +="a.title like ?";
    
                need_or = true;
                params.add(titlefilter);
            }
    
            //关键字搜索
            if(StringUtils.isNotBlank(keywordfilter)){
                keywordfilter = "%" + keywordfilter + "%";
                
                if(need_or){
                    where +=" or a.keyword like ?";
                }else{
                    where +="a.keyword like ?";
                    need_or = true;
                }
                params.add(keywordfilter);
            }
    
            //文章内容搜索
            if(StringUtils.isNotBlank(contentfilter)){
                contentfilter = "%" + contentfilter + "%";
        
                if(need_or){
                    where +=" or a.content like ?";
                }else{
                    where +="a.content like ?";
                }
                params.add(contentfilter);
            }
            
            where += " )";
        }
//        if(wheaType>=0){
//            where += " and  ( a.whea_type = ? )";
//            params.add(wheaType);
//        }
        int start = page * pagesize;
        String pageInfo = " limit " + start + "," + pagesize;
        String orderBy = " order by a.czrq desc";
        sql.append(where).append(orderBy).append(pageInfo);
        List<Map<String, Object>> result = jdbcTemplate.queryForList(sql.toString(), params.toArray());
        return result;
    }
}

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prenatalInspector/PrenatalInspectorPreCardService.java

@ -116,6 +116,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
                    JSONObject planJson = new JSONObject();
                    JSONObject pregnancy = data.getJSONObject(i);
                    String PREGNANCY_NO = pregnancy.getString("PREGNANCY_NO");//智业产检号
                    String PREGNANCY_STATUS = pregnancy.getString("PREGNANCY_STATUS");//PREGNANCY_STATUS /*妊娠是否结束,0未结束,1结束*/
                    String END_MANNER = pregnancy.getString("END_MANNER");//妊娠终止方式
                    String END_TIME = pregnancy.getString("END_TIME");//结束妊娠
                    String MENSES_LAST = pregnancy.getString("MENSES_LAST");//末次月经
@ -124,6 +125,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
                    String DELIVERY_TIME = pregnancy.getString("DELIVERY_TIME");//分娩方式时间
                    String EXAM_TIME = pregnancy.getString("EXAM_TIME");//检查日期
                    planJson.put("pregnancyNo",PREGNANCY_NO);
                    planJson.put("pregnancyStatus",PREGNANCY_STATUS);
                    planJson.put("endManner",END_MANNER);
                    planJson.put("endTime",END_TIME);
                    planJson.put("mensesLast",MENSES_LAST);
@ -227,6 +229,7 @@ public class PrenatalInspectorPreCardService extends BaseService {
                            String MENSES_LAST = pregnancy.getString("MENSES_LAST");//末次月经
                            Date dueday = DateUtil.getDueDate(DateUtil.strToDateLong(MENSES_LAST));//预产期
                            planJson.put("pregnancyNo",PREGNANCY_NO);
                            planJson.put("pregnancyStatus","0");
                            planJson.put("endManner",END_MANNER);
                            planJson.put("endTime",END_TIME);
                            planJson.put("mensesLast",MENSES_LAST);

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

@ -34,7 +34,6 @@ import com.yihu.wlyy.task.SignUploadTask;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -4091,41 +4090,4 @@ public class FamilyContractService extends BaseService {
        return rs ;
    }
    /*public Map<String,Object> getPushPatientList(int type,String[] searchTypes,String doctor,String doctorHealth){
        StringBuffer sb = new StringBuffer("SELECT p.*,sf.server_type serverType,sf.server_type_name serverTypeName,sf.team_code teamCode " +
                "from wlyy_sign_family sf LEFT JOIN wlyy_patient p ON sf.patient=p.`code`" +
                "WHERE sf.`status`>0 and (sf.doctor=? OR sf.doctor_health=?) AND p.`status`=1");
        //searchType==1重点关注2有绑定设备3孕产妇4年纪在65以上
        for (String searchType:searchTypes) {
            if("1".equals(searchType)){
                sb.append(" AND p.disease_condition =3");
            }else if("2".equals(searchType)){
                sb.append(" AND sf.`patient` IN (SELECT pd.user from wlyy_patient_device pd)");
            }else if("3".equals(searchType)){
                sb.append(" AND sf.server_type=6");
            }else if ("4".equals(searchType)){
                Calendar cal = Calendar.getInstance();
                int year =cal.get(Calendar.YEAR)-65;
                String birthday = year+"-01-01";
                sb.append("p.birthday<"+birthday);
            }
        }
        List params = new ArrayList<>();
        params.add(doctor);
        params.add(doctorHealth);
        List<PatientModel> patients = jdbcTemplate.query(sb.toString(), params.toArray(), new BeanPropertyRowMapper(PatientModel.class));
        Map<String,Object> map = new HashedMap();
        if(type==1){
            for (PatientModel patientModle: patients) {
                int serverType = patientModle.getServerType();
                String serverTypeName = patientModle.getServerTypeName();
            }
        }
        map.put("list",patients);
        return map;
    }*/
}

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

@ -647,33 +647,7 @@ public class StatisticsESService {
            resultList.add(data);
        }
        if (resultList == null || resultList.size() < 1) {
            resultList = new ArrayList<>();
            Map<String, Object> gxy = new HashMap<>();
            gxy.put("code", "1");
            gxy.put("name", "高血压");
            gxy.put("amount", Double.valueOf("0.0"));
            resultList.add(gxy);
            Map<String, Object> tnb = new HashMap<>();
            tnb.put("code", "2");
            tnb.put("name", "糖尿病");
            tnb.put("amount", Double.valueOf("0.0"));
            resultList.add(tnb);
            Map<String, Object> gxyTnb = new HashMap<>();
            gxyTnb.put("code", "3");
            gxyTnb.put("name", "高血压+糖尿病");
            gxyTnb.put("amount", Double.valueOf("0.0"));
            resultList.add(gxyTnb);
            Map<String, Object> jk = new HashMap<>();
            jk.put("code", "4");
            jk.put("name", "健康人群");
            jk.put("amount", Double.valueOf("0.0"));
            resultList.add(jk);
        }
        if (resultList != null) {
            for (Map<String, Object> map : resultList) {
                map.put("amount", map.get("amount") == null ? 0 : Math.round(Double.valueOf(map.get("amount").toString())));

+ 9 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/model/Charge.java

@ -21,7 +21,15 @@ public class Charge {
    private String userName;  // 用户姓名
    private String idType;  // 证件号码
    private String idNo;  // 证件类型
    //private String responseContent;  //扣费详情
    private String responseContent;  //扣费详情
    public String getResponseContent() {
        return responseContent;
    }
    public void setResponseContent(String responseContent) {
        this.responseContent = responseContent;
    }
    public String getTradeStatus() {
        return tradeStatus;

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

@ -419,7 +419,6 @@ public class EsStatisticsController extends BaseController {
    }
    /**
     * 指标按间隔统计  到达量
     *

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduDoctorArticleController.java

@ -448,7 +448,7 @@ public class EduDoctorArticleController extends BaseController{
            gcEduArticleService.initPatient(patientSet,labelUnitType,labelSexType,labelServeType,labelDiseaseType,labelHealthType);
            //获取保存发送记录
            List<com.yihu.es.entity.HealthEduArticlePatient> healthEduArticlePatients = gcEduArticleService.getSaveArticle(patientSet, sendCode, sendName, sendType, "", 0L, articleId, articlePic, articleTitle, articleContent, articleType, level1Type, level2Type, level,articleUrl);
            //推送微信模板消息和发送im消息
            //推送微信模板消息和发送im消息.
            new Thread(() -> {
                //发送任务到redis
                sender(healthEduArticlePatients);

+ 95 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/zysoft/ZyHealthEduArticleController.java

@ -0,0 +1,95 @@
package com.yihu.wlyy.web.third.zysoft;
import com.yihu.wlyy.entity.education.HealthEduArticle;
import com.yihu.wlyy.service.app.health.HealthEduArticleService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * 提供给智业调用的健康教育文章相关的接口:
 * @author huangwenjie
 * @date 2017/10/17 09:05
 */
@RestController
@RequestMapping("/wlyygc/zy/healthedu/article/")
public class ZyHealthEduArticleController extends BaseController {
	
	@Autowired
	private HealthEduArticleService healthEduArticleService;
	
	/**
	 * 查询健康教育文章列表
	 * @param titlefilter 文章标题搜索条件
	 * @param keywordfilter 关键字搜索条件
	 * @param contentfilter 文章内容搜索条件
	 * @param page 第几页(第一页传0)
	 * @param pagesize 分页大小
	 * @return 列表
	 */
	@ApiOperation("基卫查询健康教育文章列表")
	@RequestMapping(value = "list",method = RequestMethod.GET)
	@ResponseBody
	public String list(@RequestParam(value = "page", required = true) int page,
	                   @RequestParam(value = "pagesize", required = true) int pagesize,
	                   @RequestParam(value = "titlefilter", required = false) String titlefilter,
	                   @RequestParam(value = "keywordfilter", required = false) String keywordfilter,
	                   @RequestParam(value = "contentfilter", required = false) String contentfilter) {
		try {
			List<Map<String, Object>> list = healthEduArticleService.zyfindAll(page, pagesize, titlefilter, keywordfilter, contentfilter);
			JSONArray jsonArray = new JSONArray();
			if (list != null) {
				for (Map<String, Object> map : list) {
					JSONObject json = new JSONObject();
					json.put("id", map.get("id"));
					// 文章标识
					json.put("code", map.get("code"));
					// 文章标题
					json.put("title", map.get("title"));
					// 文章配图URL
					json.put("url", map.get("url"));
					// 文章简介
					json.put("content", String.valueOf(map.get("content"))==null?"":map.get("content"));
					// 添加日期
					json.put("czrq", DateUtil.dateToStrLong((Date) map.get("czrq")));
					// 关键字
					json.put("keyword", map.get("keyword") == null ? "" : map.get("keyword"));
					// 阅读量
					json.put("readAmount", map.get("readAmount"));
					// 收藏量
					json.put("collectionAmount", map.get("collectionAmount"));
					// 转发量
					json.put("repeatAmount", map.get("repeatAmount"));
					
					jsonArray.put(json);
				}
			}
			return write(200, "查询成功", "list", jsonArray);
		} catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1, "查询失败!");
		}
	}
	
	@RequestMapping(value = "getArticalByCode",method = RequestMethod.GET)
	@ApiOperation("获取健康教育文章详情")
	public String getArticalById(@ApiParam(name = "articleCode", value = "教育文章Code",defaultValue = "1")
	                             @RequestParam(value = "articleCode", required = true) String articleCode){
		try {
			HealthEduArticle healthEduArticle = healthEduArticleService.findArticleByCode(articleCode);
			return write(200,"查询成功!","data",healthEduArticle);
		}catch (Exception e){
			e.printStackTrace();
			return error(-1,"查询失败!");
		}
	}
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/HealthServiceController.java

@ -37,7 +37,7 @@ public class HealthServiceController extends WeixinBaseController {
			response.sendRedirect(server_url + "wx/html/home/html/login.html?type=1&openid=" + json.get("msg").toString());
		} else if (Integer.parseInt(json.get("status").toString()) == 200) {
//			String json2 = json.get("data").toString();
//			String paramUrl = getParamUrl(json2, 1);
//			String paramUrl = getParamUrl(json2, 1);12
			response.sendRedirect(server_url + "wx/html/zxwz/html/online-consulting.html");
		} else {
			response.sendRedirect(server_url + "wx/health_service/404.html");

+ 2 - 0
patient-co/patient-co-wlyy/src/main/resources/wechat/readMe.MD

@ -0,0 +1,2 @@
集美区标签
正式库103 测试库105

+ 1 - 1
patient-co/patient-co-wlyy/src/main/resources/wechat/weixin_menu_jimei.txt

@ -87,6 +87,6 @@
	 ]
  }],
    "matchrule":{
      "tag_id":"105"
      "tag_id":"103"
      }
}