Browse Source

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

zd_123 7 years ago
parent
commit
bf3410e17b
38 changed files with 615 additions and 159 deletions
  1. 43 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java
  2. 45 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  3. 50 7
      common/common-entity/src/main/java/com/yihu/wlyy/entity/job/QuartzJobConfig.java
  4. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  5. 1 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java
  6. 43 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java
  7. 45 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  8. 1 1
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/sign/SignFamilyService.java
  9. 3 3
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  10. 2 2
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/appeal/appeal_detail.jsp
  11. 4 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/appeal/appeal_detail_js.jsp
  12. 4 0
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/feedback/feedback_detail_js.jsp
  13. 2 1
      patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/team/patient/sign_family_allocate_js.jsp
  14. 1 1
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/ConsultTeamDao.java
  15. 4 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/Application.java
  16. 109 7
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/DataSourceConfig.java
  17. 27 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/jpa/HibernateProperties.java
  18. 60 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/jpa/WlyyJpa.java
  19. 2 2
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DiseaseConvert.java
  20. 2 2
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DispensaryTypeConvert.java
  21. 2 2
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionStatusConvert.java
  22. 1 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  23. 2 2
      patient-co/patient-co-statistics-es/src/main/resources/application-prod.yml
  24. 16 51
      patient-co/patient-co-statistics-es/src/main/resources/application.yml
  25. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultTeamDao.java
  26. 14 14
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  27. 14 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  28. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  29. 63 41
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java
  30. 15 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  31. 6 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java
  32. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  33. 5 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  34. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  35. 1 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/PatientHealthController.java
  36. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  37. 9 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduDoctorArticleController.java
  38. 4 3
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

+ 43 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java

@ -0,0 +1,43 @@
package com.yihu.wlyy.entity.call;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2017/11/9.
 */
@Entity
@Table(name = "manage_call_record")
public class CallRecord extends IdEntity {
    private String  code; //业务关联标识
    private String  callerNumber; //主叫号码
    private String  recipientNumber;//被叫号码
    private Integer  answerStatus;//接听状态: 1.接通,2. 队列中放弃,3.接通
    private Integer  serviceType; //服务类型:1.医生转接 2.代理咨询
    private String  serviceContent; //服务内容
    private Date createTime; //创建时间
    private Date  endTime; //通话结束时间
    private Date  updateTime; //更新时间
    private Date  callTime; //呼叫时间
    private String  talkTime; //通话时长(单位秒)格式 hh:mm:ss
    private String  userCode; //客服编码
    private String  userName; //客服名称
    private String  patient; //居民
    private String  patientName; //居民姓名
    private String  idcard; //身份证号
    private String  ssc; //社保卡号
    private String  doctor; //签约医生code
    private String  doctorName; //签约医生姓名
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
}

+ 45 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java

@ -0,0 +1,45 @@
package com.yihu.wlyy.entity.call;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2017/11/9.
 */
@Entity
@Table(name = "manage_call_service")
public class CallService extends IdEntity {
    private String code; //服务编号
    private String callCode; //关联通话记录
    private Integer serverType; //服务类型:0.医生咨询,1.预约挂号
    private String patient; //服务对象(患者code)
    private String patientName; // 服务对象名称(患者名称)
    private String ssc; // 社保卡号
    private String Idcard;  // 居民身份证号
    private String phone;  // 手机号
    private String doctor; // 医生code
    private String doctorName; //医生姓名
    private String serverContent; //服务内容
    private Integer state; //订单状态:0.草稿,1.待处理,2.完成
    private Date createTime; //创建时间
    private Date updateTime; //更新时间
    private String remark; //备注
    private Integer type; //服务类型:0.咨询,2.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
    private String dealContent; // 处理内容
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
}

+ 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_cwd")
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;
	}
}

File diff suppressed because it is too large
+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java


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

@ -70,6 +70,7 @@ public class CustomerController extends BaseController {
            req.getSession().setAttribute("code",curUser.getCode());
            req.getSession().setAttribute("name",curUser.getName());
            req.getSession().setAttribute("isLogin", "true");
            req.getSession().setAttribute("type", curUser.getType());
            req.getSession().setMaxInactiveInterval(-1);//设置session用不过期
            WlyyCustomerLog wlyyCustomerLog = new WlyyCustomerLog();
            wlyyCustomerLog.setCreateTime(new Date());

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

@ -0,0 +1,43 @@
package com.yihu.wlyy.entity.call;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2017/11/9.
 */
@Entity
@Table(name = "manage_call_record")
public class CallRecord extends IdEntity {
    private String  code; //业务关联标识
    private String  callerNumber; //主叫号码
    private String  recipientNumber;//被叫号码
    private Integer  answerStatus;//接听状态: 1.接通,2. 队列中放弃,3.接通
    private Integer  serviceType; //服务类型:1.医生转接 2.代理咨询
    private String  serviceContent; //服务内容
    private Date createTime; //创建时间
    private Date  endTime; //通话结束时间
    private Date  updateTime; //更新时间
    private Date  callTime; //呼叫时间
    private String  talkTime; //通话时长(单位秒)格式 hh:mm:ss
    private String  userCode; //客服编码
    private String  userName; //客服名称
    private String  patient; //居民
    private String  patientName; //居民姓名
    private String  idcard; //身份证号
    private String  ssc; //社保卡号
    private String  doctor; //签约医生code
    private String  doctorName; //签约医生姓名
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
}

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

@ -0,0 +1,45 @@
package com.yihu.wlyy.entity.call;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2017/11/9.
 */
@Entity
@Table(name = "manage_call_service")
public class CallService extends IdEntity {
    private String code; //服务编号
    private String callCode; //关联通话记录
    private Integer serverType; //服务类型:0.医生咨询,1.预约挂号
    private String patient; //服务对象(患者code)
    private String patientName; // 服务对象名称(患者名称)
    private String ssc; // 社保卡号
    private String Idcard;  // 居民身份证号
    private String phone;  // 手机号
    private String doctor; // 医生code
    private String doctorName; //医生姓名
    private String serverContent; //服务内容
    private Integer state; //订单状态:0.草稿,1.待处理,2.完成
    private Date createTime; //创建时间
    private Date updateTime; //更新时间
    private String remark; //备注
    private Integer type; //服务类型:0.咨询,2.预约
    private Integer dealType; //处理方式:1.电话回复,2.客服回复
    private Date dealTime; //处理时间
    private Integer dealState; // 处理结果:1.完成,2.无法联系居民
    private String dealContent; // 处理内容
    private Integer dealReason; // 处理取消原因:0.没有号源、1.病人取消
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
}

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/sign/SignFamilyService.java

@ -343,7 +343,7 @@ public class SignFamilyService extends BaseJpaService<SignFamily,Long> {
            }
            //更新IM内医生信息
            String sessionId = signFamily.getPatient()+"_consult_"+signFamily.getType();
            String imAddr = imUrl+"sessions/"+sessionId+"/participant/update";
            String imAddr = imUrl+"/sessions/"+sessionId+"/participant/update";
            JSONObject healthyparams = new JSONObject();
            if(!StringUtils.isEmpty(doctorHealth)) {
                healthyparams.put("user_id", signFamily.getDoctorHealth());

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

@ -84,9 +84,9 @@ spring:
  profiles: test
  datasource:
    wlyy:
      url: jdbc:mysql://172.17.110.160/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: ssgg
      password: ssgg
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: linzhou
      password: linzhou
    device:
      url: jdbc:mysql://172.19.103.77:3306/device?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root

+ 2 - 2
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/appeal/appeal_detail.jsp

@ -150,7 +150,7 @@
        <div class="m-form-group">
            <label class="label_title fd-padl fd-label">申诉详情描述:</label>
            <div class="fd-pd">
                <textarea class="fd-input fd-autoh" id="description" style="width: 600px; height: 100px"></textarea>
                <textarea id="description" style="width: 600px; height: 100px"></textarea>
            </div>
        </div>
        <div class="fd-group">
@ -162,7 +162,7 @@
        <div class="m-form-group ad-result" id="dealResult" style="display: none;">
            <label class="label_title ad-label">处理结果:</label>
            <div class="ad-pd">
                <textarea class="fd-input fd-autoh"  id="result1" style="width: 600px; height: 100px"></textarea>
                <textarea id="result1" style="width: 600px; height: 100px"></textarea>
            </div>
        </div>
        <div class="m-form-group" style="text-align: center;margin-top:30px;">

+ 4 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/appeal/appeal_detail_js.jsp

@ -101,11 +101,13 @@
                });
                $("#sure").click(function () {
                    $("#sure").css("pointer-events", "none");
                    var result = $("#result").val();
                    var id = $("#id").val();
                    if (isNoEmpty(result)) {
                        if(result.length>400){
                            $.Notice.error("最多只能填写400个字");
                            $("#sure").css("pointer-events", "");
                        }else {
                            $.ajax({
                                url: ctx + "/admin/appeal/dealAppeal",
@ -121,6 +123,7 @@
                                        parent.window.closeParentInfoDialog();
                                    }else{
                                        $.Notice.error(result.msg);
                                        $("#sure").css("pointer-events", "");
                                    }
                                },
                            })
@ -128,6 +131,7 @@
                    }else{
                        //todo
                        $.Notice.error("请输入处理结果");
                        $("#sure").css("pointer-events", "");
                    }
                });
                $("#cancle").click(function () {

+ 4 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/feedback/feedback_detail_js.jsp

@ -104,11 +104,13 @@
                    parent.window.closeParentInfoDialog();
                });
                $("#sure").click(function () {
                    $("#sure").css("pointer-events", "none");
                    var result = $("#result").val();
                    var id = $("#id").val();
                    if (isNoEmpty(result)) {
                        if(result.length>400){
                            $.Notice.error("最多只能填写400个字");
                            $("#sure").css("pointer-events", "");
                        }else {
                            $.ajax({
                                url: ctx + "/admin/feedback/dealFeedback",
@ -124,6 +126,7 @@
                                        parent.window.closeParentInfoDialog();
                                    }else{
                                        $.Notice.error(result.msg);
                                        $("#sure").css("pointer-events", "");
                                    }
                                },
                            })
@ -132,6 +135,7 @@
                    }else{
                        //todo
                        $.Notice.error("请输入处理结果");
                        $("#sure").css("pointer-events", "");
                    }
                });
                $("#cancle").click(function () {

+ 2 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/team/patient/sign_family_allocate_js.jsp

@ -253,7 +253,8 @@
									parent.window.closeAllocateDialog(res.msg);
									//$.Notice.success(data.msg);
								} else {
									$.Notice.error(data.msg);
									$.Notice.error(res.msg);
//									$.Notice.error(data.msg);
								}
							},
							error: function (data) {

+ 1 - 1
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/ConsultTeamDao.java

@ -14,6 +14,6 @@ import java.util.List;
public interface ConsultTeamDao extends PagingAndSortingRepository<ConsultTeam, Long>, JpaSpecificationExecutor<ConsultTeam> {
	@Query("select a from ConsultTeam a where a.patient = ?1 and a.del = '1' and a.status = 0")
	@Query("select a from ConsultTeam a where a.patient = ?1 and a.del = '1' and a.status = 0 and a.type = 8")
	List<ConsultTeam> findUnfinishedConsult(String patient);
}

+ 4 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/Application.java

@ -7,11 +7,15 @@ import org.springframework.boot.context.web.ErrorPageFilter;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
/**
 * Created by Administrator on 2016.10.12.
 */
@SpringBootApplication
@EnableJpaRepositories(
        entityManagerFactoryRef = "wlyyEntityManagerFactory",
        transactionManagerRef = "wlyyTransactionManager")
public class Application {
    public static ApplicationContext ctx = null;

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

@ -1,6 +1,8 @@
package com.yihu.wlyy.statistics.config;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
@ -15,27 +17,127 @@ import javax.sql.DataSource;
 */
@Configuration
public class DataSourceConfig {
    @Value("${spring.datasource.driverClassName}")
    private String driverClassName;
    @Value("${spring.datasource.initialSize}")
    private int initialSize;
    @Value("${spring.datasource.minIdle}")
    private int minIdle;
    @Value("${spring.datasource.maxActive}")
    private int maxActive;
    @Value("${spring.datasource.maxWait}")
    private int maxWait;
    @Value("${spring.datasource.timeBetweenEvictionRunsMillis}")
    private int timeBetweenEvictionRunsMillis;
    @Value("${spring.datasource.minEvictableIdleTimeMillis}")
    private int minEvictableIdleTimeMillis;
    @Value("${spring.datasource.validationQuery}")
    private String validationQuery;
    @Value("${spring.datasource.testWhileIdle}")
    private boolean testWhileIdle;
    @Value("${spring.datasource.testOnBorrow}")
    private boolean testOnBorrow;
    @Value("${spring.datasource.testOnReturn}")
    private boolean testOnReturn;
    @Value("${spring.datasource.primaryReadWrite.url}")
    private String primaryReadWriteUrl;
    @Value("${spring.datasource.primaryReadWrite.username}")
    private String primaryReadWriteUsername;
    @Value("${spring.datasource.primaryReadWrite.password}")
    private String primaryReadWritePassword;
    /**
     *  主数据源
     * @return
     */
    @Bean(name = "primaryReadWrite")
    @Primary//主库 默认不写名字用这个
    @ConfigurationProperties(prefix="spring.datasource.primaryReadWrite")
    public DataSource primaryReadWriteDataSource() {
        return DataSourceBuilder.create().build();
        DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(primaryReadWriteUrl);
        datasource.setUsername(primaryReadWriteUsername);
        datasource.setPassword(primaryReadWritePassword);
        datasource.setDriverClassName(driverClassName);
        //configuration
        datasource.setInitialSize(initialSize);
        datasource.setMinIdle(minIdle);
        datasource.setMaxActive(maxActive);
        datasource.setMaxWait(maxWait);
        datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
        datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
        datasource.setValidationQuery(validationQuery);
        datasource.setTestWhileIdle(testWhileIdle);
        datasource.setTestOnBorrow(testOnBorrow);
        datasource.setTestOnReturn(testOnReturn);
        return datasource;
    }
    @Value("${spring.datasource.primaryRead.url}")
    private String primaryReadUrl;
    @Value("${spring.datasource.primaryRead.username}")
    private String pprimaryReadUsername;
    @Value("${spring.datasource.primaryRead.password}")
    private String primaryReadPassword;
    @Bean(name = "primaryRead")
    @ConfigurationProperties(prefix="spring.datasource.primaryRead")
    public DataSource primaryReadDataSource() {
        return DataSourceBuilder.create().build();
        DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(primaryReadUrl);
        datasource.setUsername(pprimaryReadUsername);
        datasource.setPassword(primaryReadPassword);
        datasource.setDriverClassName(driverClassName);
        //configuration
        datasource.setInitialSize(initialSize);
        datasource.setMinIdle(minIdle);
        datasource.setMaxActive(maxActive);
        datasource.setMaxWait(maxWait);
        datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
        datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
        datasource.setValidationQuery(validationQuery);
        datasource.setTestWhileIdle(testWhileIdle);
        datasource.setTestOnBorrow(testOnBorrow);
        datasource.setTestOnReturn(testOnReturn);
        return datasource;
    }
    @Value("${spring.datasource.im.url}")
    private String imUrl;
    @Value("${spring.datasource.im.username}")
    private String imUsername;
    @Value("${spring.datasource.im.password}")
    private String imPassword;
    @Bean(name = "imData")
    @ConfigurationProperties(prefix="spring.datasource.im")
    public DataSource imDataSource() {
        return DataSourceBuilder.create().build();
    public DataSource imDataSource() {DruidDataSource datasource = new DruidDataSource();
        datasource.setUrl(imUrl);
        datasource.setUsername(imUsername);
        datasource.setPassword(imPassword);
        datasource.setDriverClassName(driverClassName);
        //configuration
        datasource.setInitialSize(initialSize);
        datasource.setMinIdle(minIdle);
        datasource.setMaxActive(maxActive);
        datasource.setMaxWait(maxWait);
        datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
        datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
        datasource.setValidationQuery(validationQuery);
        datasource.setTestWhileIdle(testWhileIdle);
        datasource.setTestOnBorrow(testOnBorrow);
        datasource.setTestOnReturn(testOnReturn);
        return datasource;
    }

+ 27 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/jpa/HibernateProperties.java

@ -0,0 +1,27 @@
package com.yihu.wlyy.statistics.config.jpa;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Properties;
/**
 * Created by chenweida on 2017/4/6.
 */
@Component
public class HibernateProperties {
    @Value("${hibernate.dialect}")
    private String dialect;
    @Value("${hibernate.show_sql}")
    private String show_sql;
    @Value("${hibernate.ejb.naming_strategy}")
    private String naming_strategy;
    public  Properties hibProperties() {
        Properties properties = new Properties();
        properties.put("hibernate.dialect",dialect);
        properties.put("hibernate.show_sql", show_sql);
        properties.put("hibernate.ejb.naming_strategy", naming_strategy);
        return properties;
    }
}

+ 60 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/jpa/WlyyJpa.java

@ -0,0 +1,60 @@
package com.yihu.wlyy.statistics.config.jpa;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
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 org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import javax.sql.DataSource;
/**
 * Created by chenweida on 2017/4/6.
 */
@Configuration
@EnableTransactionManagement
@EnableJpaRepositories(
        entityManagerFactoryRef = "wlyyEntityManagerFactory",
        transactionManagerRef = "wlyyTransactionManager",
        basePackages = {"com.yihu.wlyy.statistics.dao"})   //设置Repository所在位置
public class WlyyJpa {
    @Autowired
    private HibernateProperties hibernateProperties;
    @Bean(name = "wlyyEntityManagerFactory")
    @Primary
    public LocalContainerEntityManagerFactoryBean entityManagerFactoryPrimary(
            DataSource dataSource) {
        LocalContainerEntityManagerFactoryBean emfb = new LocalContainerEntityManagerFactoryBean();
        emfb.setDataSource(dataSource);
        emfb.setPackagesToScan("com.yihu.wlyy");
        emfb.setPersistenceUnitName("wlyy");
        JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
        emfb.setJpaVendorAdapter(vendorAdapter);
        emfb.setJpaProperties(hibernateProperties.hibProperties());
        return emfb;
    }
    @Bean(name = "wlyyTransactionManager")
    @Primary
    JpaTransactionManager transactionManagerSecondary(
            @Qualifier("wlyyEntityManagerFactory") EntityManagerFactory builder) {
        return new JpaTransactionManager(builder);
    }
}

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

@ -54,7 +54,7 @@ public class DiseaseConvert implements Convert {
//                });
//            }
        }
        return oneList;
        return returnList;
    }
    private List<String> initHealthLabesMap(JdbcTemplate jdbcTemplate, WlyyDimensionQuota temp,DataModel dataModel) {
@ -85,7 +85,7 @@ public class DiseaseConvert implements Convert {
                "  WHERE " +
                "  prescription_code = '"+dataModel.getPrescriptionCode() +"'";
        List<Map<String, Object>>  diagnosisList =jdbcTemplate.queryForList(sql);
        List<Map<String, Object>> dictList = jdbcTemplate.queryForList(temp.getDictSql());
//        List<Map<String, Object>> dictList = jdbcTemplate.queryForList(temp.getDictSql());
        for (Map<String, Object> map:diagnosisList){
//            String diagnosis = map.get("healthProblem")+"";
//            for(Map<String, Object> dict:dictList){

+ 2 - 2
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DispensaryTypeConvert.java

@ -14,7 +14,7 @@ import java.util.List;
 */
public class DispensaryTypeConvert implements Convert {
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List<DataModel> oneList, String slaveLevel, WlyyDimensionQuota temp ) {
        oneList.stream().forEach(one -> {
        for(DataModel one:oneList){
            try {
//                Object value = DataModel.class.getMethod("get" + temp.getKey()).invoke(one);
                //获取到prescriptionCode,求长处方配送方式
@ -25,7 +25,7 @@ public class DispensaryTypeConvert implements Convert {
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
        };
        return oneList;
    }
}

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

@ -20,7 +20,7 @@ import java.util.Map;
 */
public class PrescriptionStatusConvert implements Convert {
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List<DataModel> oneList, String slaveLevel, WlyyDimensionQuota temp ) {
        oneList.stream().forEach(one -> {
        for(DataModel one:oneList){
            try {
//                Object value = DataModel.class.getMethod("get" + temp.getKey()).invoke(one);
                //获取到prescriptionCode,求长处方状态
@ -33,7 +33,7 @@ public class PrescriptionStatusConvert implements Convert {
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
        };
        return oneList;
    }

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

@ -300,6 +300,7 @@ public class JobService {
        int day = daysBetween(startDate, endDate);
        for (int i = 0; i < day; i++) {
            Cache.cleanCache();//清空缓存
            Thread.sleep(60000L);//休息60秒
            productDataByOneDay(getYesterday(i, startDate));
        }
    }

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

@ -3,11 +3,11 @@ spring:
  datasource:
    primaryReadWrite:
      url: jdbc:mysql://59.61.92.90:9069/wlyy?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      url: jdbc:mysql://59.61.92.90:9069/wlyy?useUnicode=true&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
      url: jdbc:mysql://59.61.92.90:8079/wlyy?useUnicode=true&characterEncoding=utf-8&amp;autoReconnect=true
      username: wlyy
      password: jkzlehr@123
    im: #im库:

+ 16 - 51
patient-co/patient-co-statistics-es/src/main/resources/application.yml

@ -13,57 +13,17 @@ spring:
        service-url: http://localhost:8082
  datasource:
    primaryReadWrite:
      driver-class-name: com.mysql.jdbc.Driver
      max-active: 50
      max-idle: 50 #最大空闲连接
      min-idle: 10 #最小空闲连接
      validation-query-timeout: 20
      log-validation-errors: true
      validation-interval: 60000 #避免过度验证,保证验证不超过这个频率——以毫秒为单位。如果一个连接应该被验证,但上次验证未达到指定间隔,将不再次验证。
      validation-query: SELECT 1 #SQL 查询, 用来验证从连接池取出的连接, 在将连接返回给调用者之前。 如果指定, 则查询必须是一个SQL SELECT 并且必须返回至少一行记录
      test-on-borrow: true #指明是否在从池中取出连接前进行检验, 如果检验失败, 则从池中去除连接并尝试取出另一个。注意: 设置为true 后如果要生效,validationQuery 参数必须设置为非空字符串
      test-on-return: true #指明是否在归还到池中前进行检验 注意: 设置为true 后如果要生效validationQuery 参数必须设置为非空字符串
      idle-timeout: 30000
      connection-test-query: SELECT 1
      num-tests-per-eviction-run: 50 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
      test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
      min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
      time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
    primaryRead:
      driver-class-name: com.mysql.jdbc.Driver
      max-active: 50
      max-idle: 50 #最大空闲连接
      min-idle: 10 #最小空闲连接
      validation-query-timeout: 20
      log-validation-errors: true
      validation-interval: 60000 #避免过度验证,保证验证不超过这个频率——以毫秒为单位。如果一个连接应该被验证,但上次验证未达到指定间隔,将不再次验证。
      validation-query: SELECT 1 #SQL 查询, 用来验证从连接池取出的连接, 在将连接返回给调用者之前。 如果指定, 则查询必须是一个SQL SELECT 并且必须返回至少一行记录
      test-on-borrow: true #指明是否在从池中取出连接前进行检验, 如果检验失败, 则从池中去除连接并尝试取出另一个。注意: 设置为true 后如果要生效,validationQuery 参数必须设置为非空字符串
      test-on-return: true #指明是否在归还到池中前进行检验 注意: 设置为true 后如果要生效validationQuery 参数必须设置为非空字符串
      idle-timeout: 30000
      connection-test-query: SELECT 1
      num-tests-per-eviction-run: 50 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
      test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
      min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
      time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
    im:
      driver-class-name: com.mysql.jdbc.Driver
      max-active: 50
      max-idle: 50 #最大空闲连接
      min-idle: 10 #最小空闲连接
      validation-query-timeout: 20
      log-validation-errors: true
      validation-interval: 60000 #避免过度验证,保证验证不超过这个频率——以毫秒为单位。如果一个连接应该被验证,但上次验证未达到指定间隔,将不再次验证。
      validation-query: SELECT 1 #SQL 查询, 用来验证从连接池取出的连接, 在将连接返回给调用者之前。 如果指定, 则查询必须是一个SQL SELECT 并且必须返回至少一行记录
      test-on-borrow: true #指明是否在从池中取出连接前进行检验, 如果检验失败, 则从池中去除连接并尝试取出另一个。注意: 设置为true 后如果要生效,validationQuery 参数必须设置为非空字符串
      test-on-return: true #指明是否在归还到池中前进行检验 注意: 设置为true 后如果要生效validationQuery 参数必须设置为非空字符串
      idle-timeout: 30000
      connection-test-query: SELECT 1
      num-tests-per-eviction-run: 50 #在每次空闲连接回收器线程(如果有)运行时检查的连接数量,最好和maxActive
      test-while-idle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
      min-evictable-idle-time-millis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
      time-between-eviction-runs-millis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
    driverClassName: com.mysql.jdbc.Driver
    initialSize: 20
    maxActive: 50
    minIdle: 50 #最大空闲连接
    maxWait: 10
    validationQuery: SELECT 1 #SQL 查询, 用来验证从连接池取出的连接, 在将连接返回给调用者之前。 如果指定, 则查询必须是一个SQL SELECT 并且必须返回至少一行记录
    testOnBorrow: true #指明是否在从池中取出连接前进行检验, 如果检验失败, 则从池中去除连接并尝试取出另一个。注意: 设置为true 后如果要生效,validationQuery 参数必须设置为非空字符串
    testOnReturn: true #指明是否在归还到池中前进行检验 注意: 设置为true 后如果要生效validationQuery 参数必须设置为非空字符串
    testWhileIdle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
    minEvictableIdleTimeMillis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    timeBetweenEvictionRunsMillis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
    # REDIS
  redis:
@ -97,6 +57,11 @@ logging:
  level:
    root: INFO
hibernate:
  dialect: org.hibernate.dialect.MySQL5Dialect
  show_sql: false
  ejb:
    naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy
JobService:
  sleepTime: 30000

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultTeamDao.java

@ -293,4 +293,7 @@ public interface ConsultTeamDao extends PagingAndSortingRepository<ConsultTeam,
	@Query("select a.doctor from ConsultTeam a where team = ?1  and del = '1' and type=?2 ")
	List<Object> findByTeamAndType(String fromConsult, int type);
	
	@Query("select a from ConsultTeam a where a.patient = ?1 and a.del = '1' and a.status = 0 and a.type = 8")
	List<ConsultTeam> findUnfinishedConsultPrescription(String code);
}

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

@ -2630,16 +2630,14 @@ public class ConsultTeamService extends ConsultService {
     * @param prescriptionCode
     * @param type
     */
    public org.json.JSONArray addPrescriptionBloodStatusConsult(String prescriptionCode, String type,String followupid) throws Exception {
        org.json.JSONArray result = new JSONArray();
    public void addPrescriptionBloodStatusConsult(String prescriptionCode, String type,String followupid) throws Exception {
        
        if("1".equals(type)){//血压
            result = prescriptionFollowupContentService.importPatientBloodPressureToFollowup(prescriptionCode,followupid,true);
            prescriptionFollowupContentService.importPatientBloodPressureToFollowup(prescriptionCode,followupid,true);
        }else if("2".equals(type)){//血糖
            result = prescriptionFollowupContentService.importPatientBloodSugarToFollowup(prescriptionCode,followupid,true);
            prescriptionFollowupContentService.importPatientBloodSugarToFollowup(prescriptionCode,followupid,true);
        }
        
        return result;
    }
    
    /**
@ -2647,20 +2645,22 @@ public class ConsultTeamService extends ConsultService {
     * @param prescriptionCode
     * @param type
     */
    public org.json.JSONArray addPrescriptionFollowupContentConsult(String prescriptionCode, String type, String followupid) throws Exception {
    public void addPrescriptionFollowupContentConsult(String prescriptionCode, String type, String followupid) throws Exception {
        Prescription prescription = prescriptionDao.findByCode(prescriptionCode);
        org.json.JSONObject contentDoctor = new org.json.JSONObject();
        org.json.JSONObject contentobj = new org.json.JSONObject();
        //医生发送的消息
        if("1".equals(type)){
            contentDoctor.put("text", "请填写您近期身份异常症状问卷");
            contentobj.put("text","请填写您近期身份异常症状问卷");
        }else{
            contentDoctor.put("text", "请填写您近期体征及生活方式调查问卷");
            contentobj.put("text","请填写您近期体征及生活方式调查问卷");
        }
        contentDoctor.put("msgType",type);
        contentobj.put("doctorremind","已向居民发送问卷填写请求,填写完成后您将收到消息提醒");
        contentobj.put("patientremind","填写完成并提交后,医生将可以查看您的问卷内容");
        contentobj.put("msgType",type);
        //医生发送Im消息
        ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "17", contentDoctor.toString(), null);
        org.json.JSONArray result = new JSONArray();
        result.put(contentDoctor);
        return result;
        ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "17", contentobj.toString(), null);
    
        //居民发送Im消息
        ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "17", contentobj.toString(), null);
    }
}

+ 14 - 6
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java

@ -888,13 +888,17 @@ public class PatientHealthIndexService extends BaseService {
            }
    
            obj = patientHealthIndexDao.save(obj);
    
            //判断是否有未结束的续方咨询,发送消息给对应的医生
            sendPrescriptionHealthIndexMsgresult(obj,patient);
    
            //保存完后上传基卫
            new Thread(new HealthIndexUploadTask(String.valueOf(obj.getId()))).start();
//            new Thread(new HealthIndexUploadTask(String.valueOf(obj.getId()))).start();
        } else {
            throw new Exception("不存在该患者!");
        }
        return obj;
    }
    
@ -905,7 +909,7 @@ public class PatientHealthIndexService extends BaseService {
     */
    private void sendPrescriptionHealthIndexMsgresult(DevicePatientHealthIndex result, Patient patient) {
        
        List<ConsultTeam> consultTeams = consultTeamDao.findUnfinishedConsult(patient.getCode());
        List<ConsultTeam> consultTeams = consultTeamDao.findUnfinishedConsultPrescription(patient.getCode());
        
        if(1 == result.getType()){
            for (ConsultTeam consultTeam:consultTeams) {
@ -913,9 +917,11 @@ public class PatientHealthIndexService extends BaseService {
                    org.json.JSONObject contentPatient = new org.json.JSONObject();
                    //患者发送的消息
                    contentPatient.put("title", "【本消息为系统提醒】:");
                    contentPatient.put("tzMsg", "体征记录:血糖 "+result.getValue1());
                    contentPatient.put("tzMsg", "体征记录:血糖 "+result.getValue1()+" mmol/L");
                    contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                    contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以自动填入本次随访记录");
                    contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
                    contentPatient.put("needUpload","false");
                    contentPatient.put("type",1);
                    //患者发送Im消息
                    ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);
                }
@ -928,7 +934,9 @@ public class PatientHealthIndexService extends BaseService {
                    contentPatient.put("title", "【本消息为系统提醒】:");
                    contentPatient.put("tzMsg", "体征记录:血压 "+result.getValue1()+"/"+result.getValue2()+" mmHg");
                    contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                    contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以自动填入本次随访记录");
                    contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
                    contentPatient.put("needUpload","false");
                    contentPatient.put("type",2);
                    //患者发送Im消息
                    ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);
                }

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

@ -486,7 +486,8 @@ public class PrescriptionExpressageService extends BaseService {
                        "  p.patient AS patientCode, " +
                        "  py.charge_time AS chargeTime, " +
                        "  p.dispensary_type AS dispensaryType, " +
                        "  p.`status` " +
                        "  p.`status` ," +
                        "  p.code AS prescriptionCode " +
                        " FROM " +
                        " wlyy_prescription p " +
                        " JOIN wlyy_prescription_pay py ON py.prescription_code = p.`code` " +
@ -587,6 +588,8 @@ public class PrescriptionExpressageService extends BaseService {
                "  p.dispensary_type AS dispensaryType, " +
                "  p.drug_delivery_operator_name AS operatorName," +
                "  p.drug_delivery_flag AS drugDeliveryFlag, " +
                "  p.drug_delivery_time AS drugDeliveryTime," +
                "  p.code AS prescriptionCode," +
                "  p.`status` " +
                " FROM " +
                " wlyy_prescription p " +

+ 63 - 41
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java

@ -266,7 +266,7 @@ public class PrescriptionFollowupContentService extends BaseService {
	 * @param prescriptioncode
	 * @param followup_id
	 */
	public org.json.JSONArray importPatientBloodSugarToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
	public void importPatientBloodSugarToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
		Long followupId = Long.valueOf(followup_id);
		
		Followup followup =followUpDao.findOne(followupId);
@ -277,9 +277,9 @@ public class PrescriptionFollowupContentService extends BaseService {
		
		Prescription prescription = prescriptionDao.findByCode(prescriptioncode);
		
		String patientCode = prescription.getParentCode();
		String patientCode = prescription.getPatient();
		
		String stardate = DateUtil.getNextMonth(new Date(),-30)+" 00:00:00";
		String stardate = DateUtil.getNextMonth(new Date(),-1)+" 00:00:00";
		String enddate = DateUtil.getStringDateShort()+" 23:59:59";
		
		List<Object> list = healthIndexService.findIndexByPatient2(patientCode, 1, stardate, enddate, 0, 2);
@ -289,12 +289,11 @@ public class PrescriptionFollowupContentService extends BaseService {
		
		org.json.JSONObject contentDoctor = new org.json.JSONObject();
		org.json.JSONObject contentPatient = new org.json.JSONObject();
		org.json.JSONArray resultJson = new org.json.JSONArray();
		String imBloodSugarValue = "";
		String imBloodSugarDate = "";
		Date imBloodSugarDate = new Date();
		
		int total = 0;
		String sql = "select sum(category_code) amount deviceType FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
		String sql = "select sum(category_code) amount FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
		List<Map<String,Object>> result =  jdbcTemplate.queryForList(sql);
		if (result != null && result.size() > 0) {
			total = (result.get(0).get("amount") != null ? Integer.parseInt(result.get(0).get("amount").toString()) : 0);
@ -309,22 +308,52 @@ public class PrescriptionFollowupContentService extends BaseService {
				
				JSONObject obj = (JSONObject)o;
				
				imBloodSugarDate = obj.getString("recordDate");
				imBloodSugarDate = obj.getDate("recordDate");
				
				int index = Integer.valueOf(obj.getString("value2"));
				String value1 = obj.getString("value1");
				// 餐后
				if (index % 2 == 0) {
					if(StringUtils.isNotBlank(value1)){
						followupProjectData = "{'BS_FPG':'"+obj.getString("value1")+"'}";
						break;
					}
				} else { //餐前
					followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value1")+"'}";
				//餐前
				if(StringUtils.isNotBlank(obj.getString("value1"))){
					followupProjectData = "{'BS_FPG':'"+obj.getString("value1")+"'}";
					imBloodSugarValue = obj.getString("value1");
					break;
				}
				
				if(StringUtils.isNotBlank(obj.getString("value3"))){
					followupProjectData = "{'BS_FPG':'"+obj.getString("value3")+"'}";
					imBloodSugarValue = obj.getString("value3");
					break;
				}
				
				if(StringUtils.isNotBlank(obj.getString("value5"))){
					followupProjectData = "{'BS_FPG':'"+obj.getString("value5")+"'}";
					imBloodSugarValue = obj.getString("value5");
					break;
				}
				//餐后
				if(StringUtils.isNotBlank(obj.getString("value2"))){
					followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value2")+"'}";
					imBloodSugarValue = obj.getString("value2");
					break;
				}
				
				
				if(StringUtils.isNotBlank(obj.getString("value4"))){
					followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value4")+"'}";
					imBloodSugarValue = obj.getString("value4");
					break;
				}
				
				if(StringUtils.isNotBlank(obj.getString("value6"))){
					followupProjectData = "{'NO_BS_FPG':'"+obj.getString("value6")+"'}";
					imBloodSugarValue = obj.getString("value6");
					break;
				}
				
				//随机血糖
				if(StringUtils.isNotBlank(obj.getString("value7"))){
					followupProjectData = "{'RANDOM_BLOOD_SUGAR':'"+obj.getString("value7")+"'}";
					imBloodSugarValue = obj.getString("value7");
					break;
				}
			}
			
			followUpService.esSaveFollowupProjectData(followup_id, "3", followupProjectData);
@ -333,7 +362,7 @@ public class PrescriptionFollowupContentService extends BaseService {
			if(sendIM){
				//医生发送的消息
				contentDoctor.put("text", "请提供您最近一次的血糖检测数值及检测时间");
				contentDoctor.put("needupload",false);
				contentDoctor.put("needUpload","false");
				contentDoctor.put("type",2);
				
				//医生发送Im消息
@ -341,9 +370,10 @@ public class PrescriptionFollowupContentService extends BaseService {
				
				//患者发送的消息
				contentPatient.put("title", "【本消息为系统提醒】:");
				contentPatient.put("tzMsg", "体征记录:血糖"+imBloodSugarValue);
				contentPatient.put("tzTime", "检测时间:"+imBloodSugarDate);
				contentPatient.put("tzMsg", "体征记录:血糖 "+imBloodSugarValue+"mmol/L");
				contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStr(imBloodSugarDate,"yyyy-MM-dd HH:mm:ss"));
				contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
				contentPatient.put("needUpload","false");
				contentPatient.put("type",2);
				
				//患者发送Im消息
@ -354,7 +384,7 @@ public class PrescriptionFollowupContentService extends BaseService {
			if(sendIM){
				//医生发送的消息
				contentDoctor.put("text", "请提供您最近一次的血糖检测数值及检测时间");
				contentDoctor.put("needupload",true);
				contentDoctor.put("needUpload","true");
				contentDoctor.put("type",2);
				//医生发送Im消息
				ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "16", contentDoctor.toString(), null);
@ -364,6 +394,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("tzMsg", "体征记录:无");
				contentPatient.put("tzTime", "检测时间:");
				contentPatient.put("tzAlert","温馨提示:居民近30天未上传血糖体征数据,已通知居民上传数据,请耐心等待");
				contentPatient.put("needUpload","true");
				contentPatient.put("type",2);
				
				//患者发送Im消息
@ -372,10 +403,6 @@ public class PrescriptionFollowupContentService extends BaseService {
				throw new Exception("未找到30天内的血糖记录!");
			}
		}
		
		resultJson.put(contentDoctor);
		
		return resultJson;
	}
	
@ -385,7 +412,7 @@ public class PrescriptionFollowupContentService extends BaseService {
	 * @param followup_id
	 * @param sendIM 是否发送IM消息
	 */
	public org.json.JSONArray importPatientBloodPressureToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
	public void importPatientBloodPressureToFollowup(String prescriptioncode, String followup_id,boolean sendIM) throws Exception {
		
		Long followupId = Long.valueOf(followup_id);
		
@ -397,9 +424,9 @@ public class PrescriptionFollowupContentService extends BaseService {
		
		Prescription prescription = prescriptionDao.findByCode(prescriptioncode);
		
		String patientCode = prescription.getParentCode();
		String patientCode = prescription.getPatient();
		
		String stardate = DateUtil.getNextMonth(new Date(),-30)+" 00:00:00";
		String stardate = DateUtil.getNextMonth(new Date(),-1)+" 00:00:00";
		String enddate = DateUtil.getStringDateShort()+" 23:59:59";
		org.json.JSONArray jsonArray = healthIndexService.findIndexByPatient(patientCode, 2, stardate, enddate, 0, 2);
		
@ -408,10 +435,8 @@ public class PrescriptionFollowupContentService extends BaseService {
		org.json.JSONObject contentDoctor = new org.json.JSONObject();
		org.json.JSONObject contentPatient = new org.json.JSONObject();
		
		org.json.JSONArray resultJson = new org.json.JSONArray();
		
		int total = 0;
		String sql = "select sum(category_code) amount deviceType FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
		String sql = "select sum(category_code) amount FROM wlyy_patient_device WHERE user='"+prescription.getPatient()+"'";
		List<Map<String,Object>> result =  jdbcTemplate.queryForList(sql);
		if (result != null && result.size() > 0) {
			total = (result.get(0).get("amount") != null ? Integer.parseInt(result.get(0).get("amount").toString()) : 0);
@ -424,14 +449,14 @@ public class PrescriptionFollowupContentService extends BaseService {
			
			org.json.JSONObject jsonObject = jsonArray.getJSONObject(0);
			
			followupProjectData = "{'BP_D':'"+jsonObject.getString("value1")+"'BP_U':'"+jsonObject.getString("value2")+"'}";
			followupProjectData = "{'BP_D':'"+jsonObject.getString("value1")+"','BP_U':'"+jsonObject.getString("value2")+"'}";
			followUpService.esSaveFollowupProjectData(followup_id, "2", followupProjectData);
			
			//是否需要发送IM消息
			if(sendIM){
				//医生发送的消息
				contentDoctor.put("text", "请提供您最近一次的血压检测数值及检测时间");
				contentDoctor.put("needUpload",false);
				contentDoctor.put("needUpload","false");
				contentDoctor.put("type",1);
				
				//医生发送Im消息
@ -442,6 +467,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("tzMsg", "体征记录:血压"+jsonObject.getString("value1")+"/"+jsonObject.getString("value2")+" mmHg");
				contentPatient.put("tzTime", "检测时间:"+jsonObject.getString("date"));
				contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
				contentPatient.put("needUpload","false");
				contentPatient.put("type",1);
				
				//患者发送Im消息
@ -453,7 +479,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				
				//医生发送的消息
				contentDoctor.put("text", "请提供您最近一次的血压检测数值及检测时间");
				contentDoctor.put("needUpload",true);
				contentDoctor.put("needUpload","true");
				contentDoctor.put("type",1);
				//医生发送Im消息
				ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "16", contentDoctor.toString(), null);
@ -463,6 +489,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("tzMsg", "体征记录:无");
				contentPatient.put("tzTime", "检测时间:");
				contentPatient.put("tzAlert","温馨提示:居民近30天未上传血压体征数据,已通知居民上传数据,请耐心等待");
				contentPatient.put("needUpload","true");
				contentPatient.put("type",1);
				
				//患者发送Im消息
@ -471,11 +498,6 @@ public class PrescriptionFollowupContentService extends BaseService {
				throw new Exception("未找到30天内的血压记录!");
			}
		}
		
		resultJson.put(contentDoctor);
		
		return resultJson;
	
	}
	
@ -525,7 +547,7 @@ public class PrescriptionFollowupContentService extends BaseService {
			}
			//近30天血压
			String stardate = DateUtil.getNextMonth(new Date(),-30)+" 00:00:00";
			String stardate = DateUtil.getNextMonth(new Date(),-1)+" 00:00:00";
			String enddate = DateUtil.getStringDateShort()+" 23:59:59";
			org.json.JSONArray jsonArray = healthIndexService.findIndexByPatient(patientCode, 2, stardate, enddate, 0, 2);
			if(jsonArray.length() > 0){

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

@ -32,6 +32,7 @@ import com.yihu.wlyy.service.third.jw.JwArchivesService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.task.SignUploadTask;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.web.third.gateway.controller.doctor.GcDoctorController;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import org.apache.commons.lang3.StringUtils;
@ -39,6 +40,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;
@ -66,6 +69,7 @@ import java.util.*;
@Transactional
public class FamilyContractService extends BaseService {
    private Logger logger = LoggerFactory.getLogger(FamilyContractService.class);
    @Autowired
    private DoctorPatientDao doctorPatientDao;
    @Autowired
@ -680,12 +684,18 @@ public class FamilyContractService extends BaseService {
            message.setOver("1");//未处理
            message.setData(temp.getCode());
            messageDao.save(message);
            // 发送消息给医生
            JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
            if (jsonObject.getString("status").equals("1")) {
                //如果在工作时间内就推送
                pushMsgTask.put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), "您有一条新的家庭签约申请!", patient);
            try {
                // 发送消息给医生
                JSONObject jsonObject = doctorWorkTimeService.isDoctorWorking(doctor);
                if (jsonObject.getString("status").equals("1")) {
                    //如果在工作时间内就推送
                    pushMsgTask.put(doctor, MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.D_SW_01.name(), MessageType.MESSAGE_TYPE_DOCTOR_NEW_SIGN_WEB.家庭签约.name(), "您有一条新的家庭签约申请!", patient);
                }
            }catch (Exception e){
                logger.info("发送医生消息失败:"+e.getMessage());
            }
            //            新增发送医生助手模板消息 v1.4.0 by wujunjie
            if (StringUtils.isNotEmpty(d.getOpenid())){
                String url = doctorAssistant + "/doctor/feldsher/sendDoctorTemplates";

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java

@ -1101,4 +1101,10 @@ public class DateUtil {
		return date;
	}
	public static String getYear(String strDate, String format){
		Date date = strToDate(strDate,format);
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		return calendar.get(Calendar.YEAR)+"";
	}
}

+ 4 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -1155,8 +1155,8 @@ public class DoctorConsultController extends WeixinBaseController {
            @ApiParam(name = "followupid", value = "随访记录ID", defaultValue = "")
            @RequestParam(value = "followupid", required = true) String followupid){
        try{
            org.json.JSONArray result  = consultTeamService.addPrescriptionBloodStatusConsult(prescriptionCode,type,followupid);
            return write(200, "添加成功!","data",result);
            consultTeamService.addPrescriptionBloodStatusConsult(prescriptionCode,type,followupid);
            return write(200, "添加成功!");
        }catch (Exception e){
            error(e);
            return error(-1,"添加失败");
@ -1175,8 +1175,8 @@ public class DoctorConsultController extends WeixinBaseController {
            @ApiParam(name = "followupid", value = "随访记录ID", defaultValue = "")
            @RequestParam(value = "followupid", required = true) String followupid){
        try{
            org.json.JSONArray result = consultTeamService.addPrescriptionFollowupContentConsult(prescriptionCode,type,followupid);
            return write(200, "添加成功!","data",result);
            consultTeamService.addPrescriptionFollowupContentConsult(prescriptionCode,type,followupid);
            return write(200, "添加成功!");
        }catch (Exception e){
            error(e);
            return error(-1,"添加失败");

+ 5 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -5,6 +5,7 @@ import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.education.*;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.event.ApplicationEvent;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.app.consult.ConsultService;
@ -27,6 +28,8 @@ import org.htmlparser.util.ParserException;
import org.htmlparser.visitors.TextExtractingVisitor;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
@ -47,6 +50,7 @@ import java.util.*;
@Api(description = "健康教育")
public class DoctorHealthEduArticleController extends WeixinBaseController {
    private Logger logger = LoggerFactory.getLogger(DoctorHealthEduArticleController.class);
    @Autowired
    private HealthEduArticleService healthEduArticleService;
    @Autowired
@ -446,6 +450,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
                        msgs.put(patientTemp.getCode(), content);
                    }
                }catch (Exception e){
                    logger.info("eduArticle_doctor:"+doctor.getCode()+" patient:"+p +" error:"+e.getMessage());
                    error(e);
                }
            }

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

@ -256,6 +256,7 @@ public class PrescriptionInfoController extends BaseController {
            PrescriptionPay prescriptionPay = prescriptionPayService.findByPrescriptionCode(prescriptionCode);
            //获取配送信息
            PrescriptionExpressage prescriptionExpressage = prescriptionExpressageService.findByPrescriptionCode(prescriptionCode);
            jo.put("prescriptionInfos", prescriptionInfos);
            jo.put("prescriptionPay", prescriptionPay);
            jo.put("prescriptionExpressage", prescriptionExpressage);

+ 1 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/PatientHealthController.java

@ -395,8 +395,7 @@ public class PatientHealthController extends BaseController {
//                patient = getUID();
            }
            DevicePatientHealthIndex obj = healthIndexService.addPatientHealthIndex(data, type, patient, null);
            
            //血糖和血压需要校验
            if (type.equals("1") || type.equals("2")) {
                healthIndexService.verifyHealthIndex(obj.getId());

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

@ -4,6 +4,7 @@ import com.yihu.wlyy.service.app.statistics.StatisticsAllService;
import com.yihu.wlyy.service.app.statistics.StatisticsService;
import com.yihu.wlyy.service.app.statisticsES.StatisticsESService;
import com.yihu.wlyy.util.Constant;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ElasticsearchUtil;
import com.yihu.wlyy.util.ValueComparator;
import com.yihu.wlyy.web.BaseController;
@ -260,7 +261,7 @@ public class EsStatisticsController extends BaseController {
            /**旧版统计代码start**/
            //未回复-22 到达量
            JSONArray jsonArray2 = null;
            if (Constant.getNowYearByDate(endDate).equals(year)) {
            if (DateUtil.getYear(endDate,"yyyy-MM-dd").equals(year)) {
                jsonArray2 = statisticsESService.getLowLevelIncrementDetail(endDate, endDate, area, level, indexes[1], sort, lowLevel);
            } else {
                String date = Integer.valueOf(year) + 1 + "-06-30";

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

@ -460,6 +460,14 @@ public class EduDoctorArticleController extends BaseController{
    }
//    @RequestMapping(value = "/sendPatients", method = RequestMethod.POST)
//    @ResponseBody
//    @ApiOperation("文章群推送")
//    public void saveArticle(){
//
//
//    }
    /**
     * 获取要推送的患者
     * @param type
@ -482,4 +490,5 @@ public class EduDoctorArticleController extends BaseController{
        Map<String,Object> map = familyContractService.getPushPatientList(type,searchTypes,getUID(),"");
        return map;
    }*/
}

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

@ -97,19 +97,20 @@ pushMes:
  redis_prescription_title: redisPrescription
es:
  index:
    HealthEduArticlePatient: wlyy_quota_test
    HealthEduArticlePatient: health_edu_article_patient_test
    FollowUp: wlyy_followup
    Statistics: wlyy_quota_test
  type:
    HealthEduArticlePatient: wlyy_quota_test
    Statistics: wlyy_quota_test
    HealthEduArticlePatient: health_edu_article_patient_test
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
#消息队列
activemq:
  username: admin