Browse Source

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

trick9191 7 years ago
parent
commit
2225f3b617

+ 50 - 7
common/common-entity/src/main/java/com/yihu/wlyy/entity/job/QuartzJobConfig.java

@ -1,17 +1,14 @@
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_new")
public class QuartzJobConfig implements java.io.Serializable {
	private String id;
@ -23,6 +20,11 @@ public class QuartzJobConfig implements java.io.Serializable {
	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() {
@ -31,7 +33,7 @@ public class QuartzJobConfig implements java.io.Serializable {
	/** full constructor */
	public QuartzJobConfig(String jobName, String jobInfo, String jobType,
						   String jobClass, String quartzCron, String status) {
                           String jobClass, String quartzCron, String status) {
		this.jobName = jobName;
		this.jobInfo = jobInfo;
		this.jobType = jobType;
@ -124,4 +126,45 @@ public class QuartzJobConfig implements java.io.Serializable {
	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;
	}
}

+ 13 - 24
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/AppealService.java

@ -3,7 +3,6 @@ package com.yihu.wlyy.service.manager.feedback;
import com.yihu.wlyy.entity.Doctor;
import com.yihu.wlyy.entity.Message;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.SMS;
import com.yihu.wlyy.entity.feedback.Appeal;
import com.yihu.wlyy.repository.DoctorDao;
import com.yihu.wlyy.repository.MessageDao;
@ -17,7 +16,6 @@ import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -59,6 +57,8 @@ public class AppealService extends BaseService {
    private MessageDao messageDao;
    @Value("${image.imgUrlDomain}")
    private String imgUrlDomain;
    @Value(("${doctorAssistant.api}")+"/wlyygc/doctor/message")
    private String messageApi;
    /**
     * 分页查找问题
@ -214,29 +214,18 @@ public class AppealService extends BaseService {
                msgContent.append("i健康应用");
            }
            msgContent.append("查看处理结果,查看路径:账号登录—忘记密码—账号申诉—申诉记录");
            JSONObject json = smsService.sendMsg(appeal.getPhone(), msgContent.toString());
        SMS sms = new SMS();
        Date date = new Date();
        // 延后5分钟
        sms.setContent(msgContent.toString());
        sms.setDeadline(date);
        sms.setCzrq(date);
        sms.setMobile(appeal.getPhone());
        sms.setIp("127.0.0.1");
        sms.setType(11);
        sms.setStatus(1);
        sms.setCaptcha("");
        smsDao.save(sms);
        if (json == null) {
            // 发送失败
            logger.error("申诉处理完成:短信发送失败");
        } else if (json.getInt("result") != 0) {
            logger.error("申诉处理完成:短信发送失败"+json.getString("description"));
        } else {
            //发送成功,保存到数据库
            smsDao.save(sms);
        }
            List<NameValuePair> par = new ArrayList<NameValuePair>();
            par.add(new BasicNameValuePair("mobiles", appeal.getPhone()));
            par.add(new BasicNameValuePair("content", msgContent.toString()));
            try {
                logger.info("====================================================================");
                String smsresult = HttpClientUtil.post(messageApi+"/sendMessage",par,"UTF-8");
                logger.info("发送短信消息返回结果:"+smsresult);
                logger.info("======================================================================");
            }catch (Exception e){
                e.printStackTrace();
            }
            if (appeal.getIdentity() == 2) {
                String creater = appeal.getCreater();

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

@ -119,15 +119,15 @@ spring:
  profiles: prod
  datasource:
    wlyy:
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:9069/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    device:
      url: jdbc:mysql://59.61.92.90:8079/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      url: jdbc:mysql://59.61.92.90:9069/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    medicine:
      url: jdbc:mysql://59.61.92.90:8079/medicine?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      url: jdbc:mysql://59.61.92.90:9069/medicine?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: wlyy
      password: jkzlehr@123
  sms: # SMS短信配置

+ 3 - 1
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/Application.java

@ -1,8 +1,11 @@
package com.yihu.wlyy;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.boot.context.web.ErrorPageFilter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
@ -18,7 +21,6 @@ import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
        transactionManagerRef = "wlyyTransactionManager")
public class Application {
    public static ApplicationContext ctx = null;
    public static void main(String[] args) {
        ctx = SpringApplication.run(Application.class, args);
    }

+ 83 - 10
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/DataSourceConfig.java

@ -1,15 +1,22 @@
package com.yihu.wlyy.statistics.config;
import com.alibaba.druid.filter.stat.StatFilter;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import com.alibaba.druid.support.http.StatViewServlet;
import com.alibaba.druid.support.http.WebStatFilter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.embedded.FilterRegistrationBean;
import org.springframework.boot.context.embedded.ServletRegistrationBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
import java.util.Properties;
/**
 * Created by Administrator on 2016.10.20.
@ -50,9 +57,8 @@ public class DataSourceConfig {
    private Integer removeAbandonedTimeout;
    @Value("${spring.datasource.logAbandoned}")
    private Boolean logAbandoned;
    @Value("${spring.datasource.filters")
    private String filters;
    @Value("${spring.datasource.primaryReadWrite.url}")
@ -61,13 +67,15 @@ public class DataSourceConfig {
    private String primaryReadWriteUsername;
    @Value("${spring.datasource.primaryReadWrite.password}")
    private String primaryReadWritePassword;
    /**
     *  主数据源
     * 主数据源
     *
     * @return
     */
    @Bean(name = "primaryReadWrite")
    @Primary//主库 默认不写名字用这个
    public DataSource primaryReadWriteDataSource() {
    public DataSource primaryReadWriteDataSource(StatFilter statFilter) throws SQLException {
        DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(primaryReadWriteUrl);
        datasource.setUsername(primaryReadWriteUsername);
@ -90,11 +98,17 @@ public class DataSourceConfig {
        datasource.setRemoveAbandoned(removeAbandoned);
        datasource.setRemoveAbandonedTimeout(removeAbandonedTimeout);
        datasource.setLogAbandoned(logAbandoned);
        datasource.setFilters(filters);
        datasource.setConnectProperties(properties());//;# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
        datasource.setUseGlobalDataSourceStat(true);// 合并多个DruidDataSource的监控数据
        List proxyFilters = new ArrayList<>();
        proxyFilters.add(statFilter);
        datasource.setProxyFilters(proxyFilters);
        return datasource;
    }
    @Value("${spring.datasource.primaryRead.url}")
    private String primaryReadUrl;
    @Value("${spring.datasource.primaryRead.username}")
@ -103,7 +117,7 @@ public class DataSourceConfig {
    private String primaryReadPassword;
    @Bean(name = "primaryRead")
    public DataSource primaryReadDataSource() {
    public DataSource primaryReadDataSource(StatFilter statFilter) throws SQLException {
        DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(primaryReadUrl);
        datasource.setUsername(pprimaryReadUsername);
@ -126,7 +140,13 @@ public class DataSourceConfig {
        datasource.setRemoveAbandoned(removeAbandoned);
        datasource.setRemoveAbandonedTimeout(removeAbandonedTimeout);
        datasource.setLogAbandoned(logAbandoned);
        datasource.setFilters(filters);
        datasource.setConnectProperties(properties());//;# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
        datasource.setUseGlobalDataSourceStat(true);// 合并多个DruidDataSource的监控数据
        List proxyFilters = new ArrayList<>();
        proxyFilters.add(statFilter);
        datasource.setProxyFilters(proxyFilters);
        return datasource;
    }
@ -137,8 +157,10 @@ public class DataSourceConfig {
    private String imUsername;
    @Value("${spring.datasource.im.password}")
    private String imPassword;
    @Bean(name = "imData")
    public DataSource imDataSource() {DruidDataSource datasource = new DruidDataSource();
    public DataSource imDataSource(StatFilter statFilter) throws SQLException {
        DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(imUrl);
        datasource.setUsername(imUsername);
        datasource.setPassword(imPassword);
@ -160,9 +182,60 @@ public class DataSourceConfig {
        datasource.setRemoveAbandoned(removeAbandoned);
        datasource.setRemoveAbandonedTimeout(removeAbandonedTimeout);
        datasource.setLogAbandoned(logAbandoned);
        datasource.setFilters(filters);
        datasource.setConnectProperties(properties());//;# 通过connectProperties属性来打开mergeSql功能;慢SQL记录
        datasource.setUseGlobalDataSourceStat(true);// 合并多个DruidDataSource的监控数据
        List proxyFilters = new ArrayList<>();
        proxyFilters.add(statFilter);
        datasource.setProxyFilters(proxyFilters);
        return datasource;
    }
    private Properties properties() {
        Properties properties = new Properties();
        properties.put("druid.stat.mergeSql", "true");
        properties.put("slowSqlMillis", "1000");
        return properties;
    }
    //------------------------------------druid 监控----------------------------------------------
    @Bean
    public ServletRegistrationBean statViewServlet() {
        //创建servlet注册实体
        ServletRegistrationBean servletRegistrationBean = new ServletRegistrationBean(new StatViewServlet(), "/druid/*");
        //设置ip白名单
        //servletRegistrationBean.addInitParameter("allow","127.0.0.1");
        //设置ip黑名单,如果allow与deny共同存在时,deny优先于allow
        // servletRegistrationBean.addInitParameter("deny","192.168.0.19");
        //设置控制台管理用户
        servletRegistrationBean.addInitParameter("loginUsername", "jkzl");
        servletRegistrationBean.addInitParameter("loginPassword", "jkzlehr");
        //是否可以重置数据
        servletRegistrationBean.addInitParameter("resetEnable", "false");
        return servletRegistrationBean;
    }
    @Bean
    public FilterRegistrationBean filterRegistrationBean(WebStatFilter webStatFilter) {
        //创建过滤器
        FilterRegistrationBean filterRegistrationBean = new FilterRegistrationBean(webStatFilter);
        //设置过滤器过滤路径
        filterRegistrationBean.addUrlPatterns("/*");
        //忽略过滤的形式
        filterRegistrationBean.addInitParameter("exclusions", "*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*");
        return filterRegistrationBean;
    }
    @Bean
    public StatFilter statFilter() {
        return new StatFilter();
    }
    @Bean
    public WebStatFilter webStatFilter() {
        return new WebStatFilter();
    }
    //------------------------------------druid 监控----------------------------------------------
}

+ 3 - 2
patient-co/patient-co-statistics-es/src/main/resources/application.yml

@ -24,11 +24,12 @@ spring:
    testWhileIdle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
    minEvictableIdleTimeMillis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    timeBetweenEvictionRunsMillis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
    poolPreparedStatements: false # 打开PSCache,并且指定每个连接上PSCache的大小
    poolPreparedStatements: true # 打开PSCache,并且指定每个连接上PSCache的大小
    maxPoolPreparedStatementPerConnectionSize: 50
    removeAbandoned: false #超过时间限制是否回收
    removeAbandonedTimeout: 7200 #超时时间;单位为秒。180秒=3分钟
    logAbandoned: false #关闭abanded连接时输出错误日志
    filters: stat,wall,logback #配置监控统计拦截的filters,去掉后监控界面sql将无法统计,'wall'用于防火墙
    # REDIS
  redis:
    database: 0 # Database index used by the connection factory.
@ -63,7 +64,7 @@ logging:
hibernate:
  dialect: org.hibernate.dialect.MySQL5Dialect
  show_sql: false
  show_sql: true
  ejb:
    naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy

+ 30 - 30
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/health/repository/DevicePatientHealthIndexDao.java

@ -11,43 +11,43 @@ import java.util.Date;
import java.util.List;
public interface DevicePatientHealthIndexDao
        extends PagingAndSortingRepository<DevicePatientHealthIndex, Long>, JpaSpecificationExecutor<DevicePatientHealthIndex> {
		extends PagingAndSortingRepository<DevicePatientHealthIndex, Long>, JpaSpecificationExecutor<DevicePatientHealthIndex> {
    List<DevicePatientHealthIndex> findByIdcardAndType(String idcard, Integer type);
	List<DevicePatientHealthIndex> findByIdcardAndType(String idcard, Integer type);
    /**
     * 按录入时间和患者标识查询健康记录
     *
     * @param patientCode
     * @param date
     * @return
     */
    @Query("select a from DevicePatientHealthIndex a where a.user = ?1 and type = ?2 and a.recordDate = ?3 and a.del = '1'")
    Iterable<DevicePatientHealthIndex> findByPatienDate(String patientCode, int type, Date date);
	/**
	 * 按录入时间和患者标识查询健康记录
	 *
	 * @param patientCode
	 * @param date
	 * @return
	 */
	@Query("select a from DevicePatientHealthIndex a where a.user = ?1 and type = ?2 and a.recordDate = ?3 and a.del = '1'")
	Iterable<DevicePatientHealthIndex> findByPatienDate(String patientCode, int type, Date date);
    @Query("select a from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate between ?3 and ?4 and a.del = '1' group by recordDate order by recordDate asc")
    Iterable<DevicePatientHealthIndex> findByPatient(String user, int type, Date begin, Date end);
	@Query("select a from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate between ?3 and ?4 and a.del = '1' group by recordDate order by recordDate asc")
	Iterable<DevicePatientHealthIndex> findByPatient(String user, int type, Date begin, Date end);
    @Query("select a.value1 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value1 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue1ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
	@Query("select a.value1 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value1 > 0 and a.del = '1' order by recordDate desc")
	Page<String> findValue1ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value2 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value2 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue2ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
	@Query("select a.value2 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value2 > 0 and a.del = '1' order by recordDate desc")
	Page<String> findValue2ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value3 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value3 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue3ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
	@Query("select a.value3 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value3 > 0 and a.del = '1' order by recordDate desc")
	Page<String> findValue3ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value4 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value4 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue4ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
	@Query("select a.value4 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value4 > 0 and a.del = '1' order by recordDate desc")
	Page<String> findValue4ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value5 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value5 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue5ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
	@Query("select a.value5 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value5 > 0 and a.del = '1' order by recordDate desc")
	Page<String> findValue5ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value6 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value6 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue6ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
	@Query("select a.value6 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value6 > 0 and a.del = '1' order by recordDate desc")
	Page<String> findValue6ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
    @Query("select a.value7 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value7 > 0 and a.del = '1' order by recordDate desc")
    Page<String> findValue7ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
	@Query("select a.value7 from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate < ?3 and a.value7 > 0 and a.del = '1' order by recordDate desc")
	Page<String> findValue7ByPatient(String user, int type, Date recordDate, Pageable pageRequest);
	@Query("select a from DevicePatientHealthIndex a where a.user = ?1 and a.type = ?2 and a.recordDate >= ?3 and a.recordDate <= ?4 and a.del = '1'")
	Page<DevicePatientHealthIndex> findIndexByPatient(String patient, int type, Date start, Date end, Pageable pageRequest);
@ -67,7 +67,7 @@ public interface DevicePatientHealthIndexDao
	/**
	 * 获取患者一天血糖值
     */
	 */
	@Query("select a from DevicePatientHealthIndex a where a.type=1 and a.user = ?1 and DATE_FORMAT(a.recordDate,'%Y-%m-%d') = ?2 and a.del = '1' order by a.recordDate,a.id")
	List<DevicePatientHealthIndex> findByDate(String patient, String date);
@ -76,7 +76,7 @@ public interface DevicePatientHealthIndexDao
	/**
	 * 上次血糖值
     */
	 */
	@Query(value = "select a.value1 from device.wlyy_patient_health_index a where a.type=1 and a.user = ?1 and a.id<?2 and a.value2 = ?3 and a.del = '1' order by a.sort_date desc ,record_date desc limit 0,1",nativeQuery = true)
	String getPreValue(String user,Long id,String value2);
@ -98,7 +98,7 @@ public interface DevicePatientHealthIndexDao
	@Query(value = "select DATE_FORMAT(a.record_date,'%Y-%m-%d') from device.wlyy_patient_health_index a where a.user = ?1 and a.record_date >= ?2 and a.record_date <= ?3 and a.del = '1' group by DATE_FORMAT(a.record_date,'%Y-%m-%d') order by DATE_FORMAT(a.record_date,'%Y-%m-%d') desc limit ?4 ,?5",nativeQuery = true)
	List<String> findDateList(String patient,Date start ,Date end,int currentSize,int pageSize);
	@Query(value= " select * from device.wlyy_patient_health_index where type in (1,2) and record_date BETWEEN ?1 AND ?2  AND user in (select p.code from wlyy.wlyy_patient p INNER JOIN wlyy.wlyy_sign_family s on s.patient = p.code and s.status > 0 AND s.admin_team_code = ?3 and p.disease >0 and (s.doctor = ?4 or s.doctor_health =?4))",nativeQuery = true)
	@Query(value= " select * from device.wlyy_patient_health_index where type in (1,2) and record_date BETWEEN ?1 AND ?2  AND user in (select p.code from wlyy.wlyy_patient p INNER JOIN wlyy.wlyy_sign_family s on s.patient = p.code RIGHT JOIN wlyy.wlyy_sign_patient_label_info sp on sp.patient = p.code where  s.status > 0 AND s.admin_team_code = ?3 and (s.doctor = ?4 or s.doctor_health =?4) and sp.status = 1 and sp.label_type = 3 and (sp.label = 1 or sp.label = 2))",nativeQuery = true)
	List<DevicePatientHealthIndex> findByTeamcodeAndRecordDate(Date start, Date end,String teamcode,String doctorcode);
	@Query(value="select * from device.wlyy_patient_health_index where user = ?1 and type = ?2 ORDER BY record_date desc limit 0 ,5",nativeQuery = true)

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

@ -250,9 +250,9 @@ public class StatisticsESService {
        List<SaveModel> list = null;
        if (StringUtils.isNotEmpty(level2_type)) {
            list = elasticsearchUtil.findListDateQuotaLevel1(startDate, endDate, area, level, index, "1", lowLevel, level2_type);
            list = elasticsearchUtil.findListDateQuotaLevel1(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, lowLevel, level2_type);
        } else {
            list = elasticsearchUtil.findListDateQuotaLevel0(startDate, endDate, area, level, index, "1", lowLevel);
            list = elasticsearchUtil.findListDateQuotaLevel0(endDate, endDate, area, level, index, SaveModel.timeLevel_DDL, lowLevel);
        }
        if (org.springframework.util.StringUtils.isEmpty(year)) {
            year = Constant.getNowYear();

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java

@ -171,7 +171,7 @@ public class JwPrescriptionService {
            }
        }
        re.put("list",jsonArray);
        re.put("totalCount",totalCount);
        re.put("totalCount",jsonArray.size());
        re.put("errorMsg",errorMsg);
        return re;

+ 82 - 9
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -21,6 +21,7 @@ import com.yihu.wlyy.service.app.scheduling.DoctorWorkTimeService;
import com.yihu.wlyy.service.app.statistics.DoctorStatisticsService;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.template.DoctorFeldsherTemplateService;
import com.yihu.wlyy.task.DoctorStatisticsTask;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.*;
@ -33,6 +34,8 @@ import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
@ -719,7 +722,7 @@ public class ConsultController extends WeixinBaseController {
     *
     * @param consult 咨询标识
     * @param content 追问内容
     * @param type    追问内容类型:1文字,2图片,3语音
     * @param type    追问内容类型:1文字,2图片,3语音  ... (im消息类型)
     * @return
     */
    @RequestMapping(value = "append")
@ -809,7 +812,6 @@ public class ConsultController extends WeixinBaseController {
                        String doctorOpenID = doctor.getOpenid();
                        if (StringUtils.isNotEmpty(doctorOpenID)) {
                                String title = "";
                                String repContent = "";
                                Consult consultSingle = consultDao.findByCode(log.getConsult());
                                if (consultSingle!=null){
                                    Integer singleType = consultSingle .getType();
@ -818,13 +820,7 @@ public class ConsultController extends WeixinBaseController {
                                    }else if(singleType != null && singleType !=8 ){
                                        title = consultSingle.getSymptoms();
                                    }
                                    if (type == 3){
                                        repContent = "语音消息";
                                    }else if (type == 2){
                                        repContent = "图片消息";
                                    }else {
                                        repContent = content;
                                    }
                                    String repContent = parseContentType(type+"",content);
                                    String first = "居民" +patient.getName()+"的健康咨询有新的回复。";
                                    String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                    List<NameValuePair> params = new ArrayList<>();
@ -1211,4 +1207,81 @@ public class ConsultController extends WeixinBaseController {
        }
    }
    /**
     * 解析contentType
     *   PlainText: 1,   // 信息
     Image: 2,       // 图片信息
     Audio: 3,       // 语音信息
     Article: 4,     // 文章信息
     GoTo: 5,        // 跳转信息,求组其他医生或者邀请其他医生发送的推送消息
     TopicBegin: 6,  // 议题开始
     TopicEnd: 7,    // 议题结束 10 11 系统发送的会话消息
     TopicInto: 14,    // 进入议题 系统发送的会话消息
     Video:12,//视频
     System:13,//系统消息
     PrescriptionCheck:15,//续方审核消息消息
     PrescriptionBloodStatus:16,//续方咨询血糖血压咨询消息
     PrescriptionFollowupContent:17,//续方咨询随访问卷消息
     * @param contentType 消息类型
     * @return
     */
    private String parseContentType(String contentType,String content) {
        String responseContent = "";
        try {
            switch (contentType) {
                case "1":
                    responseContent = content;
                    break;
                case "2":
                    responseContent = "[图片消息]";
                    break;
                case "3":
                    responseContent = "[语音消息]";
                    break;
                case "4":
                    responseContent = "[文章消息]";
                    break;
                case "5":
                    responseContent = "[跳转链接消息]";
                    break;
                case "6":
                    responseContent = content;
                    break;
                case "7":
                    responseContent = content;
                    break;
                case "10":
                    responseContent = content;
                    break;
                case "11":
                    responseContent = content;
                    break;
                case "12":
                    responseContent = "[视频消息]";
                    break;
                case "13":
                    responseContent = content;
                    break;
                case "14":
                    responseContent = content;
                    break;
                case "15":
                    responseContent = "[续方审核消息]";
                    break;
                case "16":
                    responseContent = "[体征记录咨询消息]";
                    break;
                case "17":
                    responseContent = "[随访问卷咨询消息]";
                    break;
                default:
                    responseContent = "[咨询消息]";
                    break;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return responseContent;
    }
}

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

@ -256,7 +256,7 @@ public class EsStatisticsController extends BaseController {
            List<JSONArray> jsonArrays = new ArrayList<>();
            /**新版统计代码start**/
            //咨询数-3 增量
            //咨询数-3 到达量71
            JSONArray jsonArray1 = statisticsESService.getLowLevelTotalDetail(endDate, area, level, indexes[0], sort, lowLevel, null, year);
            jsonArrays.add(jsonArray1);
            /**新版统计代码end**/