소스 검색

es代码提交

liuwenbin 7 년 전
부모
커밋
ea049a506b
48개의 변경된 파일898개의 추가작업 그리고 490개의 파일을 삭제
  1. 5 117
      common/common-entity/src/main/java/com/yihu/wlyy/entity/job/QuartzJobConfig.java
  2. 17 0
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/CountryDao.java
  3. 78 0
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/entity/Country.java
  4. 14 1
      patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SignZYService.java
  5. 4 2
      patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  6. 67 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DiseaseConvert.java
  7. 55 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionStatusConvert.java
  8. 26 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/model/PrescriptionDisease.java
  9. 4 4
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/es/ElasticFactory.java
  10. 14 4
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/ExtractDataService.java
  11. 38 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/Contant.java
  12. 8 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/vo/DataModel.java
  13. 57 0
      patient-co/patient-co-statistics-es/src/main/resources/application-dev.yml
  14. 43 0
      patient-co/patient-co-statistics-es/src/main/resources/application-prod.yml
  15. 61 0
      patient-co/patient-co-statistics-es/src/main/resources/application-test.yml
  16. 0 239
      patient-co/patient-co-statistics-es/src/main/resources/application.yml
  17. 5 5
      patient-co/patient-co-statistics/pom.xml
  18. 40 40
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/WebSecurityConfig.java
  19. 1 1
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/dao/QuartzJobConfigDao.java
  20. 10 0
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/etl/mycache/CachePool.java
  21. 1 1
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentDayAllQuotaJob.java
  22. 12 5
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  23. 11 11
      patient-co/patient-co-statistics/src/main/resources/application.yml
  24. 2 2
      patient-co/patient-co-statistics/src/main/resources/quartz.properties
  25. 2 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/redis/RedisThread.java
  26. 40 0
      patient-co/patient-co-wlyy/doc/技术文档/es/随访记录详情新增索引.txt
  27. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/EncodingFilter.java
  28. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionAdressDao.java
  29. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionLogDao.java
  30. 3 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  31. 32 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java
  32. 8 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PatientPrescriptionPayService.java
  33. 16 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionAdressService.java
  34. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  35. 6 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionLogService.java
  36. 16 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  37. 36 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  38. 58 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  39. 6 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/system/SystemDictService.java
  40. 29 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java
  41. 4 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java
  42. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  43. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java
  44. 25 9
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java
  45. 17 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  46. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java
  47. 6 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java
  48. 7 7
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml

+ 5 - 117
common/common-entity/src/main/java/com/yihu/wlyy/entity/job/QuartzJobConfig.java

@ -1,130 +1,17 @@
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 id;
	private String quotaId;//指标id
	private String jobName;//任务名称
	private String jobInfo;//任务描述
@ -279,4 +166,5 @@ public class QuartzJobConfig implements java.io.Serializable {
	public void setCacheKey(String cacheKey) {
		this.cacheKey = cacheKey;
	}
}

+ 17 - 0
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/dao/CountryDao.java

@ -0,0 +1,17 @@
package com.yihu.wlyy.sign.dao;
import com.yihu.wlyy.sign.entity.Country;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2017/7/20.
 */
public interface CountryDao extends PagingAndSortingRepository<Country, Long> {
    @Query("from Country c where c.street=?1 AND (c.jwCode IS NOT NULL OR c.jwCode <> '')")
    List<Country> findByStreet(String street);
    Country findByCode(String code);
}

+ 78 - 0
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/entity/Country.java

@ -0,0 +1,78 @@
package com.yihu.wlyy.sign.entity;
import com.yihu.wlyy.sign.common.model.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 居委会
 * @author huangwenjie
 * @date 2017/10/26 12:55
 */
@Entity
@Table(name = "dm_country")
public class Country extends IdEntity {
	private String  province;
	private String  city;
	private String  town;
	private String  street ;
	private String  code;
	private String  name;
	private String  jwCode;
	
	public String getProvince() {
		return province;
	}
	
	public void setProvince(String province) {
		this.province = province;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getCity() {
		return city;
	}
	
	public void setCity(String city) {
		this.city = city;
	}
	
	public String getTown() {
		return town;
	}
	
	public void setTown(String town) {
		this.town = town;
	}
	
	public String getStreet() {
		return street;
	}
	
	public void setStreet(String street) {
		this.street = street;
	}
	
	public String getCode() {
		return code;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getJwCode() {
		return jwCode;
	}
	
	public void setJwCode(String jwCode) {
		this.jwCode = jwCode;
	}
}

+ 14 - 1
patient-co-service/wlyy_sign/src/main/java/com/yihu/wlyy/sign/service/SignZYService.java

@ -5,6 +5,7 @@ import com.yihu.wlyy.sign.common.SystemConfig;
import com.yihu.wlyy.sign.common.util.*;
import com.yihu.wlyy.sign.dao.*;
import com.yihu.wlyy.sign.entity.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataIntegrityViolationException;
import org.springframework.data.domain.PageRequest;
@ -75,6 +76,9 @@ public class SignZYService {
    @Autowired
    private SignFamilyServerService signFamilyServerService;
    
    @Autowired
    private CountryDao countryDao;
    /**
     * 获取机构映射
@ -1406,7 +1410,16 @@ public class SignZYService {
                    params.put("SICK_PHONE", patient.getMobile() == null ? "" : patient.getMobile());   //联系电话
                    params.put("SICK_COUNTY", patient.getTown() == null ? "" : patient.getTown());    //行政区
                    params.put("SICK_COUNTRY", patient.getStreet() == null ? "" : patient.getStreet());    //街道
                    params.put("SICK_VILLAGE", patient.getSickVillage() == null ? "" : patient.getSickVillage());    //居委会
                    
                    if(StringUtils.isNoneBlank(patient.getSickVillage())){
                        //居委会需要转换成基卫的居委会CODE
                        Country country = countryDao.findByCode(patient.getSickVillage());
                        params.put("SICK_VILLAGE", country.getJwCode());    //居委会
                    }else{
                        params.put("SICK_VILLAGE", "");    //居委会
                    }
                    
                    
                    params.put("SICK_ADDRESS",  patient.getAddress() == null ? "" : patient.getAddress());    //地址
                } else {

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

@ -1023,7 +1023,8 @@ public class FamilyContractService extends BaseService {
//        }
        // 更新签约日期
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        //sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        sf.setBegin(new Date());
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
        sf.setOpenid(patient.getOpenid());
@ -3328,7 +3329,8 @@ public class FamilyContractService extends BaseService {
        sf.setSignYear(DateUtil.getSignYear() + "");
        sf.setIsValid(0);
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        //sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        sf.setBegin(new Date());
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
        //设置转签原因
        if (StringUtils.isNotBlank(reason)) {

+ 67 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DiseaseConvert.java

@ -0,0 +1,67 @@
package com.yihu.wlyy.statistics.etl.convert.wlyy;
import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
import com.yihu.wlyy.statistics.etl.convert.wlyy.model.HealthLable;
import com.yihu.wlyy.statistics.etl.convert.wlyy.model.PrescriptionDisease;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.springframework.beans.BeanUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 长处方疾病
 * Created by zhangdan on 2017/10/26.
 */
public class DiseaseConvert implements Convert {
    @Override
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List<DataModel> oneList, String slaveLevel, WlyyDimensionQuota temp) {
        List<DataModel> returnList = new ArrayList<>();
        Map<String, List<String>> prescriptionDiseaseMap = new HashMap<>();//key是处方code value是处方标签 1高血压 2糖尿病
        //初始化标签Map
        initHealthLabesMap(jdbcTemplate, prescriptionDiseaseMap);
        //把标签Map设置到对应的维度里面
        for (DataModel dataModel : oneList) {
            List<String> healthProblems = prescriptionDiseaseMap.get(dataModel.getPrescriptionCode());
            if (healthProblems != null && healthProblems.size() > 0) {
                healthProblems.stream().forEach(str -> {
                    try {
                        DataModel dataModelTemp = new DataModel();
                        BeanUtils.copyProperties(dataModel, dataModelTemp);
                        DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(dataModelTemp, str);
                        returnList.add(dataModelTemp);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                });
            }
        }
        return returnList;
    }
    private void initHealthLabesMap(JdbcTemplate jdbcTemplate, Map<String, List<String>> prescriptionDiseaseMap) {
        //得到长处方的疾病标签(只要高血压 糖尿病)
        String sql = "SELECT " +
                "  health_problem ," +
                "  prescription_code " +
                "FROM " +
                "  wlyy_prescription_diagnosis " +
                "WHERE " +
                "  health_problem = 'HP0047' " +
                "OR health_problem = 'HP0093' ";
        List<PrescriptionDisease> prescriptionDiseases = jdbcTemplate.query(sql, new BeanPropertyRowMapper(PrescriptionDisease.class));
        prescriptionDiseases.stream().forEach(one -> {
            List<String> labels = prescriptionDiseaseMap.get(one.getPrescriptionCode());
            if (labels == null) {
                labels = new ArrayList<String>();
            }
            labels.add(one.getHealthProblem());
            prescriptionDiseaseMap.put(one.getPrescriptionCode(), labels);
        });
    }
}

+ 55 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionStatusConvert.java

@ -0,0 +1,55 @@
package com.yihu.wlyy.statistics.etl.convert.wlyy;
import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
import com.yihu.wlyy.statistics.etl.convert.wlyy.model.PrescriptionDisease;
import com.yihu.wlyy.statistics.util.Contant;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.springframework.beans.BeanUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * 长处方疾病
 * Created by zhangdan on 2017/10/26.
 */
public class PrescriptionStatusConvert implements Convert {
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List oneList, String slaveLevel, WlyyDimensionQuota temp ) {
        oneList.stream().forEach(one -> {
            try {
                Object value = DataModel.class.getMethod("get" + temp.getKey()).invoke(one);
                //获取到prescriptionCode,求长处方状态
                String sql ="SELECT status FROM wlyy_prescription WHERE code=?";
                //int status = jdbcTemplate.queryForObject(sql, Integer.class);
                Object[] args = {value};
                int status=jdbcTemplate.queryForObject(sql,args,Integer.class);
                String key = getStatusCode(status);
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, key);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
        return oneList;
    }
    public String getStatusCode(Integer status) {
        if (status >= 0 && status <= 100) {
            return Contant.prescriptionStatus.status_1;
        } else if (status==100) {
            return Contant.prescriptionStatus.status_2;
        } else if (status==-2) {
            return Contant.prescriptionStatus.status_3;
        } else if (status==-1) {
            return Contant.prescriptionStatus.status_4;
        } else if (status==-3) {
            return Contant.prescriptionStatus.status_5;
        } else{
            return "0";
        }
    }
}

+ 26 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/model/PrescriptionDisease.java

@ -0,0 +1,26 @@
package com.yihu.wlyy.statistics.etl.convert.wlyy.model;
/**
 * Created by zhangdan on 2017/10/26.
 */
public class PrescriptionDisease {
    private String healthProblem;
    private String prescriptionCode;
    public String getHealthProblem() {
        return healthProblem;
    }
    public void setHealthProblem(String healthProblem) {
        this.healthProblem = healthProblem;
    }
    public String getPrescriptionCode() {
        return prescriptionCode;
    }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
}

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

@ -55,9 +55,9 @@ public class ElasticFactory {
                .multiThreaded(true)
                .maxTotalConnection(50)// 最大链接
                .maxConnectionIdleTime(120, TimeUnit.SECONDS)//链接等待时间
                .connTimeout(30000)
                .discoveryEnabled(true)
                .readTimeout(30000)//30秒
                .connTimeout(60*1000)
               // .discoveryEnabled(true)
                .readTimeout(60*1000)//60秒
                .build());//得到链接
    }
@ -77,7 +77,7 @@ public class ElasticFactory {
    private synchronized void initTranClient() throws UnknownHostException {
        if (transportClient == null) {
            Settings settings = Settings.settingsBuilder()
                    .put("client.transport.sniff", true)//开启嗅探功能
                   // .put("client.transport.sniff", true)//开启嗅探功能
                    .put("cluster.name", StringUtils.isEmpty(clusterName) ? "jkzl" : clusterName)//默认集群名字是jkzl
                    .build();

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

@ -11,8 +11,12 @@ import io.searchbox.core.*;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
@ -35,19 +39,25 @@ public class ExtractDataService {
    @Value("${es.index}")
    private String esIndex;
    @Autowired
    private WlyyQuotaResultDao wlyyQuotaResultDao;
    @Autowired
    private ElastricSearchSave elastricSearchSave;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    private Logger logger= LoggerFactory.getLogger(ExtractDataService.class);
    public void extractOneDate(String date) {
        List<WlyyQuotaResult> quotaResults = wlyyQuotaResultDao.findByDate(date);
        String sql = "select * from wlyy_quota_result w where w.level1_type=1  and w.quato_code !=18 and w.quato_code !=19 and quota_date='" + date + "' ";
        List<WlyyQuotaResult> quotaResults = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyQuotaResult.class));
        save2es(quotaResults, date, null);
        logger.info("date:"+date+" all quota      success");
    }
    public void extractOneDateWithId(String date, String quotaId) {
        List<WlyyQuotaResult> quotaResults = wlyyQuotaResultDao.findByDateAndId(date, quotaId);
        String sql = "select * from wlyy_quota_result w where w.level1_type=1  and w.quato_code !=18 and w.quato_code !=19 and quota_date='" + date + "' and quato_code='" + quotaId + "'";
        List<WlyyQuotaResult> quotaResults = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyQuotaResult.class));
        save2es(quotaResults, date, quotaId);
        logger.info("date:"+date+",quotaId:"+quotaId+"      success");
    }
    public void extractDate2Date(String start, String end) throws Exception {

+ 38 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/Contant.java

@ -139,4 +139,42 @@ public class Contant {
        public static String level_age_5_name="51~65";
        public static String level_age_6_name=">65";
    }
    public static class prescriptionStatus{
        public static String status_1="1";
        public static String status_2="2";
        public static String status_3="3";
        public static String status_4="4";
        public static String status_5="5";
        public static String status_6="6";
        public static String status_7="7";
        public static String status_8="8";
        public static String status_9="9";
        public static String status_10="10";
        public static String status_11="11";
        public static String status_12="12";
        public static String status_13="13";
//        public static String status_1_name="续方取消";
//        public static String status_2_name="审核不通过";
//        public static String status_3_name="审核中";
//        public static String status_4_name="药师审核中";
//        public static String status_5_name="药师审核失败";
//        public static String status_6_name="开方中/药师审核成功";
//        public static String status_7_name="开方失败/预结算失败";
//        public static String status_8_name="待支付";
//        public static String status_9_name="支付成功/待配药";
//        public static String status_10_name="等待领药";
//        public static String status_11_name="配送中";
//        public static String status_12_name="已完成";
//        public static String status_13_name="进行中";
        public static String status_1_name="进行中";//大于0小于100
        public static String status_2_name="已完成";//100
        public static String status_3_name="已取消";//患者取消,-2
        public static String status_4_name="审核不通过";//-1;
        public static String status_5_name="其他原因取消";//支付超时,-3;
    }
}

+ 8 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/vo/DataModel.java

@ -22,6 +22,8 @@ public class DataModel {
    private String serverType;//服务类型
    private String healthLable;//健康标签
    private Double num=1.0;//分数 如果是累加的计算 默认是1 如果是分数从数据库拿
    private String prescriptionCode;//处方code
    public String getHealthLable() {
        return healthLable;
@ -173,4 +175,10 @@ public class DataModel {
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPrescriptionCode() { return prescriptionCode; }
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
}

+ 57 - 0
patient-co/patient-co-statistics-es/src/main/resources/application-dev.yml

@ -0,0 +1,57 @@
spring:
  profiles: dev
  datasource:
    primaryReadWrite: #只读库 主库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    primaryRead: #只读库 从库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.19.103.77/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
systemConfig:
  msg_push_server: http://172.19.103.76:3000
es:
  index: wlyy_quota_dev
  type: wlyy_quota_dev
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_dev

+ 43 - 0
patient-co/patient-co-statistics-es/src/main/resources/application-prod.yml

@ -0,0 +1,43 @@
spring:
  profiles: prod
  datasource:
    primaryReadWrite:
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    primaryRead:
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    im: #im库:
      url: jdbc:mysql://59.61.92.90:8079/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: im
      password: im!)123
  redis:
    host: 27.155.101.77 # Redis server host.
    port: 6380 # Redis server port.
    password: jkzl_ehr
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
systemConfig:
  msg_push_server: http://127.0.0.1:3000
es:
  index: wlyy_quota_prod
  type: wlyy_quota_prod
  host:  59.61.92.90
  port: 9067
  tPort: 9068
  clusterName: jkzl
wlyy:
  im:
    databaseName: im
quartz:
  name: schedulerFactoryBean_es_prod

+ 61 - 0
patient-co/patient-co-statistics-es/src/main/resources/application-test.yml

@ -0,0 +1,61 @@
spring:
  profiles: test
  datasource:
#    primaryReadWrite:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    primaryRead:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    im: #im库
#      url: jdbc:mysql://172.17.110.160/im_new?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
    primaryReadWrite:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
    primaryRead:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.17.110.160/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: ssgg
    password: ssgg
systemConfig:
  msg_push_server: http://127.0.0.1:3000
es:
  index: wlyy_quota_test
  type: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_cwd

+ 0 - 239
patient-co/patient-co-statistics-es/src/main/resources/application.yml

@ -96,242 +96,3 @@ security:
logging:
  level:
    root: INFO
redis:
  quota:
    current:
      expire: 24 #实时统计redis 的过期时间 默认是2小时
---
spring:
  profiles: test
  datasource:
#    primaryReadWrite:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    primaryRead:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    im: #im库
#      url: jdbc:mysql://172.17.110.160/im_new?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
    primaryReadWrite:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
    primaryRead:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.17.110.160/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: ssgg
    password: ssgg
systemConfig:
  msg_push_server: http://127.0.0.1:3000
es:
  index: wlyy_quota_test
  type: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_cwd
---
spring:
  profiles: prod
  datasource:
    primaryReadWrite:
      url: jdbc:mysql://59.61.92.94:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    primaryRead:
      url: jdbc:mysql://59.61.92.94:8883/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    im: #im库:
      url: jdbc:mysql://59.61.92.94/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: im
      password: im!)123
  redis:
    host: 120.41.253.95 # Redis server host.
    port: 6380 # Redis server port.
    password: jkzl_ehr
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://59.61.92.94:8883/fv?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
    username: wlyy
    password: jkzlehr@123
systemConfig:
  msg_push_server: http://127.0.0.1:3000
es:
  host: 192.168.1.1
wlyy:
  im:
    databaseName: im
quartz:
  name: schedulerFactoryBean_prod
---
spring:
  profiles: dev
  datasource:
    primaryReadWrite: #只读库 主库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    primaryRead: #只读库 从库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.19.103.77/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
systemConfig:
  msg_push_server: http://172.19.103.76:3000
es:
  index: wlyy_quota_dev
  type: wlyy_quota_dev
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_dev
---
spring:
  profiles: local
  datasource:
    primaryReadWrite: #只读库 主库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    primaryRead: #只读库 从库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
#       url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#       username: linzhou
#       password: linzhou
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.19.103.77/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
systemConfig:
  msg_push_server: http://172.19.103.76:3000
es:
  index: wlyy_quota_local
  type: wlyy_quota_local
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_local

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

@ -351,11 +351,11 @@
            <artifactId>spring-boot-starter-jdbc</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.boot</groupId>-->
            <!--<artifactId>spring-boot-starter-security</artifactId>-->
            <!--<version>${version.spring-boot}</version>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
            <version>${version.spring-boot}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>

+ 40 - 40
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/config/WebSecurityConfig.java

@ -1,40 +1,40 @@
//package com.yihu.wlyy.statistics.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
//import org.springframework.security.config.annotation.web.builders.HttpSecurity;
//import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
//import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
//
///**
// * Created by Administrator on 2016.10.17.
// */
//@Configuration
//@EnableWebSecurity
//public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
//
//    @Value("${security.basic.username}")
//    String username;
//    @Value("${security.basic.password}")
//    String password;
//
//    protected void configure(HttpSecurity http) throws Exception {
//        http.csrf().disable().authorizeRequests()
//                .anyRequest().authenticated()
//                .and()
//                .formLogin().defaultSuccessUrl("/swagger-ui.html").failureUrl("/login") //登录成功之后的跳转
//                .permitAll()
//                .and()
//                .logout().logoutSuccessUrl("/login")
//                .permitAll();
//    }
//
//    @Autowired
//    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
//            auth.inMemoryAuthentication()
//                .withUser(username).password(password).roles("USER");
//    }
//
//}
package com.yihu.wlyy.statistics.config;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
/**
 * Created by Administrator on 2016.10.17.
 */
@Configuration
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
    @Value("${security.basic.username}")
    String username;
    @Value("${security.basic.password}")
    String password;
    protected void configure(HttpSecurity http) throws Exception {
        http.csrf().disable().authorizeRequests()
                .anyRequest().authenticated()
                .and()
                .formLogin().defaultSuccessUrl("/swagger-ui.html").failureUrl("/login") //登录成功之后的跳转
                .permitAll()
                .and()
                .logout().logoutSuccessUrl("/login")
                .permitAll();
    }
    @Autowired
    public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
            auth.inMemoryAuthentication()
                .withUser(username).password(password).roles("USER");
    }
}

+ 1 - 1
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/dao/QuartzJobConfigDao.java

@ -18,7 +18,7 @@ public interface QuartzJobConfigDao extends PagingAndSortingRepository<QuartzJob
    @Query(" FROM QuartzJobConfig a WHERE a.status=?1 and a.del='1'")
    List<QuartzJobConfig> findByAll(String s);
    @Query(" FROM QuartzJobConfig a WHERE  a.del='1' ")
    @Query(" FROM QuartzJobConfig a WHERE  a.del='1' and a.id != 11")
    List<QuartzJobConfig> findByIds();
    @Query(" FROM QuartzJobConfig a WHERE a.id=?1 and a.del='1'")

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

@ -262,6 +262,15 @@ public class CachePool {
        diseaseGroup.clear();
        healthGroup.clear();
        serverGroup.clear();
        arriveRenewSignOrgOutMap.clear();
        arriveRenewSignTeamOutMap.clear();
        arriveRenewSignTownOutMap.clear();
        arriveRenewTotalCityMap.clear();
        arriveRenewTotalOrgMap.clear();
        arriveRenewTotalTeamMap.clear();
        arriveRenewTotalTownMap.clear();
        renewDiseaseGroup.clear();;
    }
    public static Map<String, CacheModel> getArriveSignFamilyExpenseStatus1Map() {
@ -335,6 +344,7 @@ public class CachePool {
        if (model == null) {
            model = new RenewCacheModel();
            String sql=" select fr.sign_code code,fr.hospital ,fr.admin_team_id ,fr.patient " +
                    "   from wlyy_sign_family_renew_log fr " +
                    "   where " +

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

@ -337,7 +337,7 @@ public class CurrentDayAllQuotaJob implements Job {
        computequota_8(sql, signFamilies, null);//统计今天的签约患者年龄
        computequota_9();//统计今天的待签约
        computequota_10();//统计今天的改签
        computequota_12(sql, signFamilies, null);//统计今天的签约下按年龄分组后再
       // computequota_12(sql, signFamilies, null);//统计今天的签约下按年龄分组后再  无效
        computequota_13(sql, signFamilies, null);//统计今天的签约量
        computequota_16_1(sql, signFamilies, null);//统计今天的签约数的扣费钱
        computequota_15(sql, signFamilies, null);//统计今天的健康分布统计

+ 12 - 5
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/service/JobService.java

@ -20,6 +20,8 @@ import com.yihu.wlyy.statistics.model.signfamily.SignFamily;
import com.yihu.wlyy.statistics.vo.WlyyJobConfigVO;
import com.yihu.wlyy.statistics.vo.WlyyQuotaVO;
import org.quartz.SchedulerException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -37,6 +39,8 @@ import java.util.*;
 */
@Service
public class JobService {
    private Logger logger= LoggerFactory.getLogger(JobService.class);
    @Autowired
    private QuartzHelper quartzHelper;
@ -54,6 +58,8 @@ public class JobService {
    @Autowired
    private CachePool cachePool;
    private Long sleepTime=60000L;
    @Transactional
    public void stopById(String id) throws Exception {
        QuartzJobConfig quartzJobConfig = wlyyJobConfigDao.findById(id, "1");
@ -164,7 +170,7 @@ public class JobService {
                params.put("yesterday", getYesterday(0 - i));
                if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                    quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                    Thread.sleep(60000L);
                    Thread.sleep(sleepTime);
                }
            }
        }
@ -206,7 +212,8 @@ public class JobService {
            params.put("yesterday", yesterday);
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                Thread.sleep(60000L);
                logger.info(quartzJobConfig.getId());
                Thread.sleep(sleepTime);
            }
        }
@ -252,7 +259,7 @@ public class JobService {
        params.put("yesterday", yesterday);
        if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
            quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
            Thread.sleep(60000L);
            Thread.sleep(sleepTime);
        }
    }
@ -283,7 +290,7 @@ public class JobService {
            params.put("yesterday", getYesterday(0 - i));
            if (!StringUtils.isEmpty(quartzJobConfig.getJobClass())) {
                quartzHelper.startNow(getRightClass(quartzJobConfig), quartzJobConfig.getId() + UUID.randomUUID().toString().replace("-", ""), params);
                Thread.sleep(60000L);
                Thread.sleep(sleepTime);
            }
        }
    }
@ -418,7 +425,7 @@ public class JobService {
        params.put("now", yesterday);
        params.put("yesterday", day);
        quartzHelper.startNow(HealthMessageJob.class, HealthMessageJob.jobKey + UUID.randomUUID().toString().replace("-", ""), params);
        Thread.sleep(60000L);
        Thread.sleep(sleepTime);
    }
    public void productHealthDataByDayToDay(String start, String end) throws Exception {

+ 11 - 11
patient-co/patient-co-statistics/src/main/resources/application.yml

@ -167,17 +167,17 @@ spring:
  datasource:
    primaryReadWrite:
      url: jdbc:mysql://10.95.22.7:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    primaryRead:
      url: jdbc:mysql://10.95.22.7:3306/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    im: #im库:
      url: jdbc:mysql://10.95.22.7:3306/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: im
      password: im!)123
       url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
       username: wlyy
       password: jkzlehr@123
     primaryRead:
       url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
       username: wlyy
       password: jkzlehr@123
     im: #im库:
       url: jdbc:mysql://59.61.92.90:8079/im?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
       username: im
       password: im!)123
  redis:
    host: 10.95.22.142 # Redis server host.

+ 2 - 2
patient-co/patient-co-statistics/src/main/resources/quartz.properties

@ -9,11 +9,11 @@ org.quartz.scheduler.rmi.proxy: false
org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
 
org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
org.quartz.threadPool.threadCount: 20
org.quartz.threadPool.threadCount: 50
org.quartz.threadPool.threadPriority: 5
org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
 
org.quartz.jobStore.misfireThreshold: 60000
org.quartz.jobStore.misfireThreshold: 600000
 
#============================================================================
# Configure JobStore

+ 2 - 1
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/redis/RedisThread.java

@ -36,6 +36,7 @@ public class RedisThread implements Runnable {
    private PushMsgTask pushMsgTask;
    //redis链接池
    private JedisPool pool;
    private Jedis jedis;
    @Override
    public void run() {
@ -45,7 +46,6 @@ public class RedisThread implements Runnable {
        while (true){
            try {
                Jedis jedis = pool.getResource();
                String message = jedis.rpop(key);
                if(StringUtils.isEmpty(message)){
                    sleep(1000L);//如果没有读取到记录,等待1秒
@ -80,6 +80,7 @@ public class RedisThread implements Runnable {
        }else {
            pool = new JedisPool(poolConfig,host,port,100000);
        }
        jedis = pool.getResource();
    }
    public void redisMessage(String message){

+ 40 - 0
patient-co/patient-co-wlyy/doc/技术文档/es/随访记录详情新增索引.txt

@ -0,0 +1,40 @@
创建索引
POST  http://172.19.103.68:9200/wlyy_followup
查询索引
GET http://172.19.103.68:9200/wlyy_followup/
给索引加mapping
POST http://172.19.103.68:9200/wlyy_followup/wlyy_followup_content/_mapping
{
    "wlyy_followup_content": {
        "properties": {
            "followup_id": {
                "type": "string",
                "index": "not_analyzed"
            },
            "followup_project": {
                "type": "string",
                "index": "not_analyzed"
            },
            "followup_key": {
                "type": "string",
                "index": "not_analyzed"
            },
            "followup_value": {
                "type": "string",
                "index": "not_analyzed"
            },
            "create_time": {
                "type": "string",
                "index": "not_analyzed"
            }
        }
    }
}
增加索引搜索大小
PUT  http://172.19.103.68:9200/wlyy_followup/_settings
{
  "index": {
    "max_result_window": 500000
  }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/EncodingFilter.java

@ -39,7 +39,7 @@ public class EncodingFilter implements Filter {
                newRequest.addParameter(key, URLDecoder.decode((value),"utf-8"));
            }
        }
        logger.info(" reqURL:"+request.getRequestURI());
        logger.debug("reqURL:"+request.getRequestURI());
        chain.doFilter(newRequest, response);
    }

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionAdressDao.java

@ -4,8 +4,12 @@ import com.yihu.wlyy.entity.patient.prescription.PrescriptionAdress;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2017/10/20.
 */
public interface PrescriptionAdressDao extends PagingAndSortingRepository<PrescriptionAdress, Long>, JpaSpecificationExecutor<PrescriptionAdress> {
    List<PrescriptionAdress> findByPatient(String patient);
}

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/prescription/PrescriptionLogDao.java

@ -14,4 +14,7 @@ public interface PrescriptionLogDao extends PagingAndSortingRepository<Prescript
    @Query(" from PrescriptionLog l where l.prescriptionCode=?1 and l.status in ?2 order by createTime desc")
    List<PrescriptionLog> findPrescriptionLogsByPrescriptionCode(String prescriptionCode, Integer[] types);
    @Query(" from PrescriptionLog l where l.prescriptionCode=?1 and l.status = ?2 ")
    List<PrescriptionLog> findByPrescriptionCodeAndStutas(String prescriptionCode, int status);
}

+ 3 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -969,8 +969,9 @@ public class ConsultTeamService extends ConsultService {
//            if("0".equals(checkPre)){//存在未结算的续方
//                return -3;
//            }
            Doctor doctor = doctorDao.findByCode(doctorCode);
            ct.setAdminTeamId(signFamily.getAdminTeamId());
            Doctor doctor = doctorDao.findByAdminTeamId(signFamily.getAdminTeamId());
            doctorCode = doctor.getCode();
            // 查询患者信息
            Patient p = patientDao.findByCode(patient);

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

@ -21,7 +21,6 @@ import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.DrHealthTeamService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.system.SystemDictService;
import com.yihu.wlyy.task.FollowupUploadTask;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.lang3.StringUtils;
@ -451,7 +450,7 @@ public class FollowUpService extends BaseService {
    /**
     * 新增临时随访记录(返回ID)
     */
    public String addFollowup(String doctorCode, String patientCode, String date, String followupType, String followupClass, String followupManagerStatus) throws Exception {
    public String addFollowup(String doctorCode, String patientCode, String date, String followupType, String followupClass, String followupManagerStatus,String plandate) throws Exception {
        String re = "";
        //获取医生信息
@ -495,6 +494,37 @@ public class FollowUpService extends BaseService {
        //保存质询code
        followup.setSignCode(patientService.getSignCodeByPatient(patientCode));
        //计划下次随访时间--ysj.2017.10.26
        if(StringUtils.isNoneBlank(plandate)){
            followup.setFollowupNextDate(DateUtil.strToDate(plandate));
            Followup nextFollowup = new Followup();
            nextFollowup.setDataFrom(followup.getDataFrom());
            nextFollowup.setStatus("2");
            nextFollowup.setFollowupType(followupType);
            nextFollowup.setFollowupNo(followup.getFollowupNo());
            nextFollowup.setFollowupDate(DateUtil.strToDate(plandate));
            nextFollowup.setFollowupPlanDate(DateUtil.strToDate(plandate));
            nextFollowup.setJwdoctorCode(followup.getJwdoctorCode());
            nextFollowup.setJworgCode(followup.getJworgCode());
            nextFollowup.setOrgCode(followup.getOrgCode());
            nextFollowup.setOrgName(followup.getOrgName());
            nextFollowup.setCreater(followup.getCreater());
            nextFollowup.setSignCode(followup.getSignCode());
            nextFollowup.setAdminTeamCode(followup.getAdminTeamCode());
            nextFollowup.setFollowupClass(followupClass);
            nextFollowup.setFollowupManagerStatus(followupManagerStatus);
            nextFollowup.setPatientName(followup.getPatientName());
            nextFollowup.setPatientCode(followup.getPatientCode());
            nextFollowup.setCreateTime(new Date());
            nextFollowup.setUpdateTime(new Date());
            nextFollowup.setDoctorCode(followup.getDoctorCode());
            nextFollowup.setDoctorName(followup.getDoctorName());
            nextFollowup.setIdcard(followup.getIdcard());
            nextFollowup.setSignType(followup.getSignType());
            followupDao.save(nextFollowup);
        }
        followupDao.save(followup);
        re = String.valueOf(followup.getId());
        return re;

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

@ -117,6 +117,8 @@ public class PatientPrescriptionPayService extends BaseService {
    private PrescriptionInfoService infoService;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private PrescriptionDispensaryCodeService codeService;
    /**
     * 长处方配送信息查询接口
@ -742,13 +744,13 @@ public class PatientPrescriptionPayService extends BaseService {
                            message.setCzrq(new Date());
                            messageDao.save(message);
                        }
                        //支付成功发起结算
                        //支付成功生成二维码
                        result = prescriptionCode;
//                        try {
//                            jwPrescriptionService.executeSickSettle(prescriptionCode);
//                        } catch (Exception e) {
//                            e.printStackTrace();
//                        }
                        try {
                            codeService.saveQRCode(prescriptionCode);
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    } else if ("1".equals(tradeStatus) || "FAIL".equals(tradeStatus)) {
                        prescriptionPay.setTradeStatus("0");//交易状态 成功1 失败0
                        prescription.setStatus(PrescriptionLog.PrescriptionLogStatus.pay_error.getValue());////续费状态 30支付成功 21支付失败

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

@ -32,14 +32,28 @@ public class PrescriptionAdressService extends BaseService {
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        return rs;
    }
    public Map<String,Object> getDefAdress(String patient){
        String sql = "SELECT ad.* FROM wlyy_prescription_adress ad WHERE ad.patient ='"+patient+"' AND ad.default_flag = 1";
        List<Map<String,Object>> rs = jdbcTemplate.queryForList(sql);
        if(rs!=null&&rs.size()>0){
            return rs.get(0);
        }else{
            return null;
        }
    }
    //保存
    public String saveAdress(String adressJosn){
        JSONObject jsonObject = JSONObject.fromObject(adressJosn);
        PrescriptionAdress p = (PrescriptionAdress) net.sf.json.JSONObject.toBean(jsonObject,PrescriptionAdress.class);
        p.setCreateTime(new Date());
        if(p.getDefaultFlag()==1){
            String sql ="UPDATE wlyy_prescription_adress set defaultFlag = 0 WHERE patient ='"+p.getPatient()+"' ";
            jdbcTemplate.execute(sql);
            List<PrescriptionAdress> list =  prescriptionAdressDao.findByPatient(p.getPatient());
            if(list!=null&&list.size()>0){
                String sql ="UPDATE wlyy_prescription_adress set default_flag = 0 WHERE patient ='"+p.getPatient()+"' ";
                jdbcTemplate.execute(sql);
            }
        }
        prescriptionAdressDao.save(p);
        return "1";

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

@ -177,6 +177,7 @@ public class PrescriptionInfoService extends BaseService {
                for (int i = 0; i < pres.size(); i++) {
                    com.alibaba.fastjson.JSONObject r = (com.alibaba.fastjson.JSONObject) pres.get(i);
                    //判断是否在审核中
                    String rState = presCheckStateObj(r.getString("code"));
                    if ("1".equals(rState)) {
                        r.put("reviewedState", 1);
@ -1073,6 +1074,8 @@ public class PrescriptionInfoService extends BaseService {
                " p.sex, " +
                " p.photo, " +
                " pr.`status`, " +
                " pr.patient," +
                " pr.admin_team_id," +
                " pr.`code`, " +
                " LEFT(pr.create_time,19) AS createTime, " +
                " pr.doctor, " +

+ 6 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionLogService.java

@ -37,7 +37,12 @@ public class PrescriptionLogService extends BaseService {
     * @param userType 1 患者 2医生
     */
    public void addLog(Prescription prescription,Integer type,Integer flag,Integer userType){
        PrescriptionLog log = new PrescriptionLog();
        PrescriptionLog log = null;
        List<PrescriptionLog> prescriptionLogs = prescriptionLogDao.findByPrescriptionCodeAndStutas(prescription.getCode(),prescription.getStatus());
        if (prescriptionLogs == null || prescriptionLogs.size() ==0){
            log = new PrescriptionLog();
        }
        log = prescriptionLogDao.findOne(prescriptionLogs.get(0).getId());
        log.setStatus(prescription.getStatus());
        log.setType(type);
        log.setCode(getCode());

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

@ -624,7 +624,9 @@ public class FamilyContractService extends BaseService {
        sf.setSignSource("2");//签约来源【1 社区签约 2 移动签约】
        //******************扣费接口**********************/
        sf.setExpensesStatus("0");   //扣费状态 【0未扣费 1已扣费 2已退费】
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        //sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        sf.setBegin(new Date());
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
        sf.setSignYear(DateUtil.getSignYear() + "");
@ -926,7 +928,11 @@ public class FamilyContractService extends BaseService {
        SignFamily sf = new SignFamily();
        String signCode = getCode();
        sf.setSignYear(DateUtil.getSignYear() + "");//设置签约年度
        sf.setBegin(DateUtil.getNowDateShort());
        //===1.3.9 修改 ======
        sf.setBegin(new Date());
        //====================
        sf.setCode(signCode);
        sf.setCzrq(new Date());
@ -1321,7 +1327,8 @@ public class FamilyContractService extends BaseService {
            }
            // 更新签约日期
            sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
            //sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
            sf.setBegin(new Date());
            sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
@ -3346,7 +3353,10 @@ public class FamilyContractService extends BaseService {
        sf.setSignYear(DateUtil.getSignYear() + "");
        sf.setIsValid(0);
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        //sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        sf.setBegin(new Date());
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
        //设置转签原因
        if (StringUtils.isNotBlank(reason)) {
@ -3538,7 +3548,8 @@ public class FamilyContractService extends BaseService {
        sf.setSignYear(year + "");
        sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        //sf.setBegin(DateUtil.stringToDate(DateUtil.getSignYear() + "-07-01 00:00:00", "yyyy-MM-dd HH:mmm:ss"));
        sf.setBegin(new Date());
        sf.setEnd(DateUtil.stringToDate(DateUtil.getSignYear() + 1 + "-06-30 23:59:59", "yyyy-MM-dd HH:mmm:ss"));
        if (StringUtils.isNotBlank(reason)) {

+ 36 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -3118,17 +3118,15 @@ public class StatisticsService extends BaseService {
                    " GROUP BY dateNo";
            planSQL = "SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('" + DateUtil.getFristDayOfMonth() + "', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS planCount " +
                    "FROM " +
                    " wlyy_followup w " +
                    "WHERE " +
                    " left(w.create_time,10) AS dateNo,COUNT(1) AS planCount " +
                    " FROM " +
                    "  wlyy_followup w " +
                    " WHERE " +
                    " w.admin_team_code =" + teamCode +
                    " AND w.create_time >= '" + startDate + "' " +
                    " AND w.create_time <= '" + endDate + "' " +
                    " AND w.status ='2'" +
                    " GROUP BY weekOfMonth";
                    " GROUP BY dateNo";
        } else {
            //按月
            totalSQL = "SELECT " +
@ -4906,6 +4904,17 @@ public class StatisticsService extends BaseService {
                " AND p.`status` = ? " +
                " AND p.create_time <= ? " +
                " AND p.create_time >= ? ";
        String cancelSql = "SELECT " +
                " count(1) count" +
                " FROM " +
                " wlyy_prescription p " +
                " WHERE " +
                " p.admin_team_id = ? " +
                " AND p.`status` <= ? " +
                " AND p.create_time <= ? " +
                " AND p.create_time >= ? ";
        Map<String,Object> rs = new HashedMap();
        //总数
        List<Map<String,Object>> total = jdbcTemplate.queryForList(totalSql,new Object[]{adminTeamId,endDate,startDate});
@ -4943,7 +4952,7 @@ public class StatisticsService extends BaseService {
            rs.put("noReviewedCount",0);
        }
        //其他原因取消
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(stateSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue(),endDate,startDate});
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(cancelSql,new Object[]{adminTeamId,PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue(),endDate,startDate});
        if(total!=null&&total.size()>0){
            rs.put("payOuttimeCount",payOuttimeCount.get(0).get("count"));
        }else{
@ -4980,7 +4989,7 @@ public class StatisticsService extends BaseService {
        processingSql += " AND  p.`status` < " + PrescriptionLog.PrescriptionLogStatus.finish.getValue() +
                " AND p.`status`>= " + PrescriptionLog.PrescriptionLogStatus.revieweding.getValue() ;
        //已完成,已经取消,审核不通过,其他原因取消
        //已完成,已经取消,审核不通过
        String stateSql = "SELECT " +
                " count(1) count" +
                " FROM " +
@ -4992,6 +5001,18 @@ public class StatisticsService extends BaseService {
        }
        stateSql += " AND p.`status` = ? " ;
        //其他原因取消
        String cancelSql = "SELECT " +
                " count(1) count" +
                " FROM " +
                " wlyy_prescription p ";
        if(StringUtils.isNotBlank(disease)){
            cancelSql += " JOIN wlyy_prescription_diagnosis d ON  d.prescription_code = p.code WHERE d.health_problem ='"+disease+"' ";
        }else{
            cancelSql +=" WHERE 1=1 ";
        }
        cancelSql += " AND p.`status` <= ? " ;
        //市区
        if("4".equals(level)){
            //市区无过滤
@ -5000,11 +5021,13 @@ public class StatisticsService extends BaseService {
            totalSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
            processingSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
            stateSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
            cancelSql += " AND LEFT(p.hospital, 6) = '"+area+"' ";
        //机构
        }else if("2".equals(level)){
            totalSql += " AND p.hospital = '"+area+"' ";
            processingSql += " AND p.hospital = '"+area+"' ";
            stateSql += " AND p.hospital = '"+area+"' ";
            cancelSql += " AND p.hospital  = '"+area+"' ";
        }
        Map<String,Object> rs = new HashedMap();
@ -5044,7 +5067,7 @@ public class StatisticsService extends BaseService {
            rs.put("noReviewedCount",0);
        }
        //其他原因取消
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(stateSql,new Object[]{PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()});
        List<Map<String,Object>> payOuttimeCount = jdbcTemplate.queryForList(cancelSql,new Object[]{PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()});
        if(total!=null&&total.size()>0){
            rs.put("payOuttimeCount",payOuttimeCount.get(0).get("count"));
        }else{
@ -5109,7 +5132,7 @@ public class StatisticsService extends BaseService {
            sql +=" AND p.`status` <'"+PrescriptionLog.PrescriptionLogStatus.finish.getValue()+"' " +
                  " AND p.`status`>='"+PrescriptionLog.PrescriptionLogStatus.revieweding+"'";
        }else if("6".equals(type)){
            sql +=" AND p.`status` ='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
            sql +=" AND p.`status` <='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
        }
        sql += " AND p.create_time >='"+DateUtil.dateToStr(dd.getTime(),"YYYY-MM-dd HH:mm:ss")+"' AND p.create_time <='"+ DateUtil.dateToStr(new Date(),"YYYY-MM-dd HH:mm:ss")+"'  GROUP BY LEFT(p.create_time,7) ";
@ -5275,7 +5298,7 @@ public class StatisticsService extends BaseService {
            }
        }
        rs = jdbcTemplate.queryForList(sql);
        if("1".equals(level)){
        if("1".equals(lowlevel)){
            statisticsAllService.translateTeamLeaderName2(rs);
        }
        return rs;
@ -5301,7 +5324,7 @@ public class StatisticsService extends BaseService {
            sql +=" AND p.`status` <'"+PrescriptionLog.PrescriptionLogStatus.finish.getValue()+"' " +
                    " AND p.`status`>='"+PrescriptionLog.PrescriptionLogStatus.revieweding+"'";
        }else if("6".equals(type)){
            sql +=" AND p.`status` ='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
            sql +=" AND p.`status` <='"+PrescriptionLog.PrescriptionLogStatus.pay_outtime.getValue()+"'";
        }
        return sql;

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

@ -5,6 +5,7 @@ import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionDispensaryCode;
import com.yihu.wlyy.entity.patient.prescription.PrescriptionLog;
import com.yihu.wlyy.entity.statistics.PopulationBase;
import com.yihu.wlyy.repository.address.TownDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamDao;
@ -19,6 +20,7 @@ import io.searchbox.client.JestClient;
import io.searchbox.core.Bulk;
import io.searchbox.core.BulkResult;
import io.searchbox.core.Index;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
@ -2645,4 +2647,60 @@ public class StatisticsESService {
        }
        return new JSONArray(totalList);
    }
    public Map<String,Object> getPrescriptionCount(int level,String area,String disease) throws Exception{
        String index ="58";
        Map<String,Object> rs = new HashedMap();
        //总数
        List<SaveModel> totalList =  elasticsearchUtil.findListDateQuotaLevel1(null,area,level,index,"2",null,disease);
        //进行中
        List<SaveModel> processingList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"1");
        //已完成
        List<SaveModel> finishedList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"2");
        //已经取消
        List<SaveModel> canceledList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"3");
        //审核不通过
        List<SaveModel> unPassList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"4");
        //其他原因取消
        List<SaveModel> otherList =  elasticsearchUtil.findListDateQuotaLevel2(null,area,level,index,"2",null,disease,"5");
        //总数
        if(totalList!=null && totalList.size()>0){
            rs.put("total",totalList.get(0).getResult2());
        }else{
            rs.put("total",0);
        }
        //进行中
        if(processingList!=null && processingList.size()>0){
            rs.put("processingCount",processingList.get(0).getResult2());
        }else {
            rs.put("processingCount", 0);
        }
        //已完成
        if(finishedList!=null && finishedList.size()>0){
            rs.put("finishCount",finishedList.get(0).getResult2());
        }else {
            rs.put("finishCount", 0);
        }
        //已取消
        if(canceledList!=null && canceledList.size()>0){
            rs.put("patientCancelCount",canceledList.get(0).getResult2());
        }else {
            rs.put("patientCancelCount", 0);
        }
        //审核不通过
        if(unPassList!=null && unPassList.size()>0){
            rs.put("noReviewedCount",unPassList.get(0).getResult2());
        }else {
            rs.put("noReviewedCount", 0);
        }
        //其他原因取消
        if(otherList!=null && otherList.size()>0){
            rs.put("payOuttimeCount",otherList.get(0).getResult2());
        }else {
            rs.put("payOuttimeCount", 0);
        }
        return rs;
    }
}

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/system/SystemDictService.java

@ -45,6 +45,12 @@ public class SystemDictService {
                String exit = redisTemplate.opsForValue().get("systemDict:" + dictName);
                if (!StringUtils.isEmpty(exit)) {
                    re = redisTemplate.opsForValue().get("systemDict:" + dictName + ":" + code);
                    if(StringUtils.isEmpty(re)){
                        re = systemDictDao.findByDictNameAndCode(dictName,code);
//                        if (!StringUtils.isEmpty(re)) {
//                            redisTemplate.opsForValue().set("systemDict:" + dictName + ":" + code, re);
//                        }
                    }
                } else {
                    List<SystemDict> list = systemDictDao.findByDictName(dictName);
                    if (list != null && list.size() > 0) {

+ 29 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/weixin/wxpay/service/OnePayService.java

@ -243,6 +243,7 @@ public class OnePayService {
            charge.setCode(uuid);  //  接入应用支付业务流水号
            Date now = new Date();
            charge.setCreateTime(now);
            charge.setUpdateTime(now);
            charge.setPatient(patient);     //  用户
            charge.setOpenid(openid);     //  用戶微信openid
@ -711,6 +712,8 @@ public class OnePayService {
     * 更改数据 wlyy_sign_family wlyy_charge
     */
    public void updateData(String chargeStatus, Date chargeTime, String chargeNo, WlyyCharge charge) throws Exception {
        charge.setUploadLog("1");
        charge.setUpdateTime(new Date());
        chargeDao.save(charge);
//        成功支付根据wlyy_charge的code 去查找关联代码signCode在更新签约表
        if ("0".equals(chargeStatus)) {
@ -719,14 +722,14 @@ public class OnePayService {
    }
    /**
     * 按月缴费获取签约月数
     * 按月缴费获取签约月数(算法已更改)
     *
     * @param fromStr
     * @param toStr
     * @param formatStr
     * @return
     */
    public static int monthBetween(String fromStr, String toStr, String formatStr) {
    public static int monthBetweenBak(String fromStr, String toStr, String formatStr) {
        try {
            SimpleDateFormat format = new SimpleDateFormat(formatStr);
            Calendar bef = Calendar.getInstance();
@ -742,6 +745,30 @@ public class OnePayService {
        }
    }
    /**
     * 按月缴费获取签约月数
     *
     * @param fromStr
     * @param toStr
     * @param formatStr
     * @return
     */
    public static int monthBetween(String fromStr, String toStr, String formatStr) {
        SimpleDateFormat format = new SimpleDateFormat(formatStr);
        try {
            Calendar bef = Calendar.getInstance();
            Calendar aft = Calendar.getInstance();
            bef.setTime(format.parse(fromStr));
            aft.setTime(format.parse(toStr));
            int result = aft.get(Calendar.MONTH) - bef.get(Calendar.MONTH);
            int month = (aft.get(Calendar.YEAR) - bef.get(Calendar.YEAR)) * 12;
            return Math.abs(month + result) + 1;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }
    /**
     * 按月缴费获取总金额
     *

+ 4 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/followup/DoctorFollowUpController.java

@ -192,9 +192,11 @@ public class DoctorFollowUpController extends BaseController {
                              @ApiParam(name = "followupClass", value = "随访类别【1.高血压 2.糖尿病】", defaultValue = "1")
                              @RequestParam(value = "followupClass", required = true) String followupClass,
                              @ApiParam(name = "followupManagerStatus", value = "随访管理状态【字典FOLLOWUP_MANAGER_STATUS】", defaultValue = "1")
                              @RequestParam(value = "followupManagerStatus", required = false) String followupManagerStatus) {
                              @RequestParam(value = "followupManagerStatus", required = false) String followupManagerStatus,
                              @ApiParam(name = "plandate", value = "下次随访时间", defaultValue = "2016-12-14 20:00:00")
                              @RequestParam(value = "plandate", required = false) String plandate) {
        try {
            String response = followUpService.addFollowup(getUID(), patient, date, followupType, followupClass, followupManagerStatus);
            String response = followUpService.addFollowup(getUID(), patient, date, followupType, followupClass, followupManagerStatus,plandate);
            return write(200, "新增临时随访记录成功!", "data", response);
        } catch (Exception e) {

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java

@ -25,7 +25,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Created by Trick on 2017/7/25.
 * Created by Trick on 2017/7/25
 */
@RestController
@RequestMapping(value = "/doctor/prescriptionInfo")

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionController.java

@ -103,7 +103,7 @@ public class PatientPrescriptionController extends WeixinBaseController {
            @RequestParam(value = "code", required = true) String code) {
        try {
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code, prescriptionCode, 2);
            PrescriptionDispensaryCode prescriptionDispensaryCode = prescriptionDispensaryCodeService.saveQRCode(code,prescriptionCode, 2);
            if (prescriptionDispensaryCode == null) {
                return error(-1, "生成配送员取药码失败!");
            } else {

+ 25 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionPayController.java

@ -216,30 +216,42 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
        }
    }
//===========================v1.3.9======================================================================
    @RequestMapping(value = "/getAdressList", method = RequestMethod.POST)
    @ApiOperation(value = "获取患者所有默认地址")
    @RequestMapping(value = "/getAddressList", method = RequestMethod.POST)
    @ApiOperation(value = "获取患者所有地址")
    public String getAdressList( @ApiParam(name = "patient", value = "居民code")
                                     @RequestParam(value = "patient", required = true)String patient){
        try {
            prescriptionAdressService.getAdressList(patient);
            return write(200, "发送成功!");
            return write(200, "获取成功!","data",prescriptionAdressService.getAdressList(patient));
        } catch (Exception e) {
            return error(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "/getDefAddress", method = RequestMethod.POST)
    @ApiOperation(value = "获取患者默认地址")
    public String getDefAdress(String patient){
        try {
            return write(200, "获取成功!","data",prescriptionAdressService.getDefAdress(patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "发送失败!");
        }
    }
    @RequestMapping(value = "/saveAdress", method = RequestMethod.POST)
    @RequestMapping(value = "/saveAddress", method = RequestMethod.POST)
    @ApiOperation(value = "保存地址")
    public String saveAdress(@ApiParam(name = "adressJosn", value = "实体json串")
                             @RequestParam(value = "adressJosn", required = true)String adressJosn){
    public String saveAdress(@ApiParam(name = "addressJson", value = "实体json串")
                             @RequestParam(value = "addressJson", required = true)String addressJson){
        try {
            return write(200, "获取成功!", "data", prescriptionAdressService.saveAdress(adressJosn));
            return write(200, "获取成功!", "data", prescriptionAdressService.saveAdress(addressJson));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
    @RequestMapping(value = "/delAdress", method = RequestMethod.POST)
    @RequestMapping(value = "/delAddress", method = RequestMethod.POST)
    @ApiOperation(value = "删除地址")
    public String delAdress(@ApiParam(name = "id", value = "主键")
                                @RequestParam(value = "id", required = true)Long id){
@ -247,6 +259,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.delAdress(id));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
@ -258,6 +271,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.getProvince());
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
@ -270,6 +284,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.getCityByProvince(province));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }
@ -282,6 +297,7 @@ public class PatientPrescriptionPayController extends WeixinBaseController {
            return write(200, "获取成功!", "data", prescriptionAdressService.getTowmByCity(city));
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败!");
        }
    }

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

@ -9,6 +9,7 @@ import com.yihu.wlyy.util.ValueComparator;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.quota.vo.SaveModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
@ -1589,4 +1590,20 @@ public class EsStatisticsController extends BaseController {
            return error(-1, "查询失败");
        }
    }
    //=================================长处方分析===============================================
    @RequestMapping("/getPrescriptionCount")
    @ResponseBody
    @ApiOperation("订单统计-顶部总数获取")
    public String getPrescriptionCount(@ApiParam(name="level", value="级别") @RequestParam(required = true)String level,
                                       @ApiParam(name="area", value="级别对应编码") @RequestParam(required = true)String area,
                                       @ApiParam(name="disease", value="疾病类型") @RequestParam(required = false)String disease){
        try{
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionCount(elasticsearchUtil.changeLevel(Integer.valueOf(level)),area,disease));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
}

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

@ -1670,6 +1670,7 @@ public class StatisticsController extends BaseController {
    @RequestMapping("/getPrescriptionCount")
    @ResponseBody
    @ApiOperation("订单统计-顶部总数获取")
    @Deprecated
    public String getPrescriptionCount(@ApiParam(name="level", value="级别") @RequestParam(required = true)String level,
                                       @ApiParam(name="area", value="级别对应编码") @RequestParam(required = true)String area,
                                       @ApiParam(name="disease", value="疾病类型") @RequestParam(required = false)String disease){

+ 6 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java

@ -120,7 +120,7 @@ public class OnePayController extends WeixinBaseController {
                    json.put("bindStatus", "000000");
                    json.put("sicardUrl", sicardUrl);
                    msg = "查询绑卡信息成功!";
                    return write(200, "", "data", json);
                    return write(200, msg, "data", json);
                } else {
                    json.put("sicardUrl", sicardUrl);
                    json.put("bindStatus", "030007");
@ -347,6 +347,7 @@ public class OnePayController extends WeixinBaseController {
            charge.setIdType(idType);
            charge.setIdNo(idNo);
            charge.setTradeStatus(chargeStatus);
            charge.setUpdateTime(new Date());
            if (param.has("responseContent") && (param.getJSONObject("responseContent") != null)) {
                String requestParam = param.getString("responseContent");
@ -520,10 +521,12 @@ public class OnePayController extends WeixinBaseController {
                    charge.setIdType(idType);
                    charge.setIdNo(idNo);
                    charge.setTradeStatus(chargeStatus);
                    charge.setUpdateTime(new Date());
                    String miRegisterNo = "";//医保签约号
                    if (requestParams.has("responseContent") && (requestParams.getJSONObject("responseContent") != null)) {
                        JSONObject responseContents = requestParams.getJSONObject("responseContent");//医保结构体
                    if (requestParam.has("responseContent")) {
                        String tempcontent = requestParam.getString("responseContent");//医保结构体
                        JSONObject responseContents = new JSONObject(tempcontent);
                        String miCollectDate = null;//扣费日期
                        String miCollectTime = null;//扣费时间
                        String miSettleNo = null;//扣费单据号

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

@ -12,16 +12,16 @@ spring:
      password: jkzlehr@123
  redis:
    host: 120.41.253.95 # Redis server host.
    port: 6380 # Redis server port.
    password: jkzl_ehr
     host: 27.155.101.77 # Redis server host.
     port: 6380 # Redis server port.
     password: jkzl_ehr
server:
  server_url: http://www.xmtyw.cn/wlyy/
im:
  im_list_get: http://120.41.253.95:3000/
  im_list_get: http://27.155.101.77:3000/
  data_base_name: im
wechat:
@ -96,9 +96,9 @@ es:
    HealthEduArticlePatient: health_edu_article_patient_prod
  type:
    HealthEduArticlePatient: health_edu_article_patient_prod
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  host: 59.61.92.90
  port: 9065
  tPort: 9066
  clusterName: jkzl
#消息队列