Quellcode durchsuchen

es代码提交

Conflicts:
	patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
ES代码提交
liuwenbin vor 7 Jahren
Ursprung
Commit
22a9fbeecc
51 geänderte Dateien mit 842 neuen und 453 gelöschten Zeilen
  1. 6 0
      common/common-entity/pom.xml
  2. 43 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java
  3. 45 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  4. 50 7
      common/common-entity/src/main/java/com/yihu/wlyy/entity/job/QuartzJobConfig.java
  5. 2 2
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  6. 1 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/common/account/CustomerController.java
  7. 18 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Message.java
  8. 43 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallRecord.java
  9. 45 0
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/call/CallService.java
  10. 7 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/AppealService.java
  11. 5 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/FeedbackService.java
  12. 4 4
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  13. 1 1
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/ConsultTeamDao.java
  14. 18 25
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  15. 0 60
      patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorFeldsherTemplateController.java
  16. 21 31
      patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml
  17. 21 31
      patient-co/patient-co-doctor-assistant/src/main/resources/application-devtest.yml
  18. 21 31
      patient-co/patient-co-doctor-assistant/src/main/resources/application-local.yml
  19. 21 31
      patient-co/patient-co-doctor-assistant/src/main/resources/application-localtest.yml
  20. 21 31
      patient-co/patient-co-doctor-assistant/src/main/resources/application-test.yml
  21. 4 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/Application.java
  22. 120 7
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/DataSourceConfig.java
  23. 27 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/jpa/HibernateProperties.java
  24. 60 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/jpa/WlyyJpa.java
  25. 17 4
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/AgeConvert.java
  26. 9 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DiseaseConvert.java
  27. 2 2
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionStatusConvert.java
  28. 1 2
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/extract/db/DBExtract.java
  29. 8 1
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/JobService.java
  30. 5 5
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/IdCardUtil.java
  31. 2 2
      patient-co/patient-co-statistics-es/src/main/resources/application-prod.yml
  32. 18 52
      patient-co/patient-co-statistics-es/src/main/resources/application.yml
  33. 0 1
      patient-co/patient-co-wlyy/pom.xml
  34. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  35. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/consult/ConsultTeamDao.java
  36. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java
  37. 14 14
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  38. 26 29
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  39. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionExpressageService.java
  40. 63 41
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java
  41. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  42. 15 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  43. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  44. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackTemplateController.java
  45. 5 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  46. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/PrescriptionInfoController.java
  47. 1 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/PatientHealthController.java
  48. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  49. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/service/GcEduArticleService.java
  50. 7 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduDoctorArticleController.java
  51. 4 3
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml

+ 6 - 0
common/common-entity/pom.xml

@ -63,5 +63,11 @@
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.boot</groupId>-->
            <!--<artifactId>spring-boot-starter-data-elasticsearch</artifactId>-->
            <!--<version>1.1.1.RELEASE</version>-->
        <!--</dependency>-->
    </dependencies>
</project>

+ 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;
	}
}

Datei-Diff unterdrückt, da er zu groß ist
+ 2 - 2
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());

+ 18 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Message.java

@ -45,6 +45,24 @@ public class Message extends IdEntity {
	private String tzType;//体征类别
	private String tzCode;//体征code
	private Integer sex;//患者性别
	private String relationCode;//业务关联code,type=6时为咨询code,type=7、8、9时为续方code type = 10/11时为申诉和反馈ID
	private String prescriptionStatus;//type=6续方审核状态 0待审核,1审核通过,2审核失败,3居民取消|type=7续方状态 0待取药,1已取药
	public String getRelationCode() {
		return relationCode;
	}
	public void setRelationCode(String relationCode) {
		this.relationCode = relationCode;
	}
	public String getPrescriptionStatus() {
		return prescriptionStatus;
	}
	public void setPrescriptionStatus(String prescriptionStatus) {
		this.prescriptionStatus = prescriptionStatus;
	}
	public String getCode() {
		return code;

+ 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;
    }
}

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

@ -240,11 +240,12 @@ public class AppealService extends BaseService {
            if (appeal.getIdentity() == 2) {
                String creater = appeal.getCreater();
                SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                String newDate = formatDate.format(new Date());
                Date createTime = appeal.getCreateTime();
                String newDate = formatDate.format(createTime);
                String title = "新增系统消息";
                String content = "您在" + newDate + "提交的意见反馈已处理,您可点此查看处理结果";
                String content = "您在" + newDate + "提交的账号申诉已处理,您可点此查看处理结果";
                Message message = new Message();
                message.setType(10);
                message.setType(11);
                message.setCode(UUID.randomUUID().toString());
                message.setCzrq(new Date());
                message.setCreateTime(new Date());
@ -254,14 +255,16 @@ public class AppealService extends BaseService {
                message.setSender("system");//设置发送的用户
                message.setTitle(title);
                message.setReadonly(1);//是否只读消息
                message.setRelationCode(id.toString());
                //wlyy给医生发送系统消息
                Doctor doctor = doctorDao.findByCode(creater);
                String doctorOpenID = doctor.getOpenid();
                String url = wlyyService + "/patient/feedback/sendMessage";
                String url = wlyyService + "/doctor/feedback/sendMessage";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("receiver", creater));
                params.add(new BasicNameValuePair("title", title));
                params.add(new BasicNameValuePair("type", "11"));
                params.add(new BasicNameValuePair("content", content));
                HttpClientUtil.post(url, params, "UTF-8");

+ 5 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/FeedbackService.java

@ -232,7 +232,8 @@ public class FeedbackService extends BaseService {
                }
            } else if (identity == 2) {
                SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                String newDate = formatDate.format(new Date());
                Date createTime = feedback.getCreateTime();
                String newDate = formatDate.format(createTime);
                String title = "新增系统消息";
                String content = "您在" + newDate + "提交的意见反馈已处理,您可点此查看处理结果";
                Message message = new Message();
@ -246,14 +247,16 @@ public class FeedbackService extends BaseService {
                message.setSender("system");//设置发送的用户
                message.setTitle(title);
                message.setReadonly(1);//是否只读消息
                message.setRelationCode(feedback.getId().toString());
                //wlyy给医生发送系统消息
                Doctor doctor = doctorDao.findByCode(creater);
                String doctorOpenID = doctor.getOpenid();
                String url = wlyyService + "/patient/feedback/sendMessage";
                String url = wlyyService + "/doctor/feedback/sendMessage";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("receiver", creater));
                params.add(new BasicNameValuePair("title", title));
                params.add(new BasicNameValuePair("type", "10"));
                params.add(new BasicNameValuePair("content",content));
                HttpClientUtil.post(url, params, "UTF-8");

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

@ -76,7 +76,7 @@ yueren:
doctorAssistant:
  api: http://192.168.131.113:8080
wlyyService:
  api: http://10.95.22.10:8011/wlyy/
  api: http://192.168.131.113:8081
image:
  imgUrlDomain: http://172.19.103.54/
---
@ -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

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

+ 18 - 25
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java

@ -904,34 +904,27 @@ public class DeviceService {
     * @param patient
     */
    private void sendPrescriptionHealthIndexMsgresult(PatientHealthIndex result, Patient patient) {
        
        List<ConsultTeam> consultTeams = consultTeamDao.findUnfinishedConsult(patient.getCode());
    
        if(1 == result.getType()){
            for (ConsultTeam consultTeam:consultTeams) {
                if(1 == consultTeam.getHealthindexType() || 3 == consultTeam.getHealthindexType()){
                    org.json.JSONObject contentPatient = new org.json.JSONObject();
                    //患者发送的消息
                    contentPatient.put("title", "【本消息为系统提醒】:");
                    contentPatient.put("tzMsg", "体征记录:血糖 "+result.getValue1());
                    contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                    contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以自动填入本次随访记录");
                    //患者发送Im消息
                    ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);
                }
            }
        }else if(2 == result.getType()){
            for (ConsultTeam consultTeam:consultTeams) {
                if(2 == consultTeam.getHealthindexType() || 3 == consultTeam.getHealthindexType()){
                    org.json.JSONObject contentPatient = new org.json.JSONObject();
                    //患者发送的消息
                    contentPatient.put("title", "【本消息为系统提醒】:");
        for (ConsultTeam consultTeam:consultTeams) {
            if(consultTeam.getHealthindexType() != null){
                org.json.JSONObject contentPatient = new org.json.JSONObject();
                //患者发送的消息
                contentPatient.put("title", "【本消息为系统提醒】:");
                if(1 == result.getType()){
                    contentPatient.put("tzMsg", "体征记录:血糖 "+result.getValue1()+" mmol/L");
                    contentPatient.put("type",2);
                }else if(2 == result.getType()){
                    contentPatient.put("tzMsg", "体征记录:血压 "+result.getValue1()+"/"+result.getValue2()+" mmHg");
                    contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                    contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以自动填入本次随访记录");
                    //患者发送Im消息
                    ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);
                }
                    contentPatient.put("type",1);
                }else{}
            
                contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
                contentPatient.put("needUpload","false");
            
                //患者发送Im消息
                ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);
            }
        }

+ 0 - 60
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorFeldsherTemplateController.java

@ -1,60 +0,0 @@
package com.yihu.wlyy.web.doctor.template;
import com.yihu.wlyy.repository.template.DoctorGuidanceTempDao;
import com.yihu.wlyy.service.template.DoctorFeldsherTemplateService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * 医生健康指导模板
 * <p>
 * Created by Reece on 2017/9/14.
 */
@RestController
@RequestMapping(value = "/doctor/feldsher")
@Api(description = "医生健康指导模板")
public class DoctorFeldsherTemplateController extends BaseController {
    @Autowired
    private DoctorFeldsherTemplateService feldsherTemplateService;
    @Autowired
    DoctorGuidanceTempDao guidanceTempDao;
    /**
     * @param doctorCode   医生code
     * @param sessionId    会话Id
     * @param sessionType  会话类型
     * @param businessType 消息类型
     * @param from         发送者
     * @param content      消息内容
     * @return
     */
    @RequestMapping(value = "/sendDoctorTemplate", method = RequestMethod.POST)
    @ApiOperation(value = "医生助手给医生发送模板消息")
    public String sendDoctorTemplate(@RequestParam @ApiParam(value = "医生code") String doctorCode,
                                     @RequestParam @ApiParam(value = "会话Id", required = false) String sessionId,
                                     @RequestParam @ApiParam(value = "会话类型", required = false) String sessionType,
                                     @RequestParam @ApiParam(value = "消息类型") String businessType,
                                     @RequestParam @ApiParam(value = "发送者", required = false) String from,
                                     @RequestParam @ApiParam(value = "消息内容") String content) {
        try {
            Boolean flag = feldsherTemplateService.sendDoctorTemplate(doctorCode, sessionId, sessionType, businessType, from, content);
            if (flag){
                return write(200, "发送成功!");
            }else {
                return write( -1, "发送失败!");
            }
        } catch (Exception e) {
            e.printStackTrace();
            return invalidUserException(e, -1, "发送失败!");
        }
    }
}

+ 21 - 31
patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml

@ -26,40 +26,30 @@ im:
  data_base_name: ichat
wechat:
  appId: wxd03f859efdf0873d
  appSecret: 2935b54b53a957d9516c920a544f2537
  appId: wxb3827510b2e15012
  appSecret: c5bdedd909ded9c2ee08028487e6f50d
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fweixin.xmtyw.cn%2fwlyy-dev
  accId: gh_ffd64560fb21
  accId: gh_aa9cd602b84b
  message:
   ##医生追加建议提醒 --签约邀请
   doctor_invitel_template: TLWrBtNE2kBJaFCdVzDOOnQC8N2TtRY9ZxEzwZXQcR0
   #咨询回复
   template_consult_notice: qSOW0DBxO3qEBm4ucG0Ial0jxsOyD7_f2TFK5e-mQEc
   #签约成功
   template_sign_success: hDWV_sknKlhxhOwR5h68OCXbAhRpcgnx9INrT8BybE8
   #签约失败
   template_sign_failed: ezgttXE7rG4rAboQK2ituG1dKq4PeyCj3LxGJWO_vOA
   #健康指导提醒
   template_health_notice: 128RCfyCHi22jW8PZzo7vabKMsA3SBv5VeHaDPr2Bhw
   #解约提醒
   template_termination:  LrrzHjnIF67ww5uQUvSiv3_pVKJiIK4ZE3fKrvsT0AE
   #预约成功
   template_appoint_success:  Bo2yqNczSU9zkg4wXoouv9tSeefZ6TziggWL3dTXPYE
   #预约取消
   template_appoint_failed:  pErTBTdweIdrNRf_1Oo62YtQC0aHwPvtLaCzw44JzCQ
   #缴费提醒
   template_expenses_remind:  BkTGJ8S18qZ3DfaptAXnZznAk8RJjx9v93og5vyO0bs
   #健康教育
   template_healthy_article: LA7erINJ0CSsG2G_ZCrgsDaX3krhsI4qg_NSHEyL_l4
   #医生变更
   template_doctor_change:  TNIDMjduVKgVL4-k71umYLpHROvFB8K6mmm8aZC_EH8
   #问卷调查
   template_doctor_survey:  IjQvzBy0PLeft2kN9mdBhACXPE9I_jyJywJ6B-JRxsY
   #审核结果通知
   template_doctor_audit:  OFyLUeBW3r9trWw-i6pbB1sPSTD4J2recCv_mc-gKxA
   #服务结果通知
   template_doctor_service:  ezr5RlX0nvh7bGU9aVsGDMJbjKDp1uMKP-AGGYXwI5g
   ##处方待处理提醒
   template_prescription_pending: aPl14500g7SblWWGBsisRgFGqtSskiGxmhGMD5tS9ik
   ##服务状态提醒
   template_consult_notice: 5eOa_Wx60tqsbuQK7ITTgRXB-8SntBONvopai_HFnhY
   #居民体征异常提醒
   template_abnormal_signs: 5i4OuDef0Bzk3SBD9iuhOGqoCH0OSaH3HYIC8Sgg-yA
   #咨询请求通知
   template_consult_request: TeiAPgxC7JTVfWa24fkemlJ8Nvji_NCPYmxKzXql05A
   #签约申请通知
   template_sign_request: 7zB0Qf4nUEZlkGnoElmx8I4Q5dm0Gq9JZP6PCzl9b7s
   #随访提醒
   template_followup_success: -9blCMt1b7t24biL7QbkmQH0KWLgOIDQ5LtyX_Ai49E
   #处理结果通知
   template_treatment_result: J3W3-ZGZ5miHd0Ka1JLaXCYkIoCdiuJ-c527PH5nPQI
   #咨询回复提醒
   template_consult_reply: x7fIXWcd1YsXAnwhP-gmW1D__GtzD39j5KZLudoe0Y0
   #代办事项提醒
   template_schedule_remind: z32DERzD6X4ShOl86sI3YCOWl-lkr5Z9sKh1w_YG8Bs
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/

+ 21 - 31
patient-co/patient-co-doctor-assistant/src/main/resources/application-devtest.yml

@ -26,40 +26,30 @@ im:
  data_base_name: im_new
wechat:
  appId: wx088a4d8e8208e6ce
  appSecret: ab3cdd509fb76fd0149e8864c97e8ddb
  appId: wxb3827510b2e15012
  appSecret: c5bdedd909ded9c2ee08028487e6f50d
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fwww.xmtyw.cn%2fassistant
  accId: gh_b0f086d0d2f5
  accId: gh_aa9cd602b84b
  message:
    ##医生追加建议提醒 --签约邀请
    doctor_invitel_template:  uXdBJVbrhKG-WLaCG4s8C4SXSr2kknQ94vKFt-3rIiA
    #咨询回复
    template_consult_notice: dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18
    #签约成功
    template_sign_success: VYGj8OUKj6FH4i4_nZS2UAHurJxQHx-7_OBPILIdB8s
    #签约失败
    template_sign_failed: m221Jrkm0UUY00ExTCpQNTB8t_1U_V4LR9Bg8BgH9-o
    #健康指导提醒
    template_health_notice: 5Nts8lA_at9Cd1JuTK-qDxx95lchpcmUfPTEwYDgXYQ
    #解约提醒
    template_termination:  qZm1NwSueAsbHaOf9DrnLoSj0X5gZuh9W7aDYzLWNds
    #预约成功
    template_appoint_success:  vU5x2tGyk1zUngBrEqMfnFqqMa6M8J98w8k5MCSUYM
    #预约取消
    template_appoint_failed:  r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
    #缴费提醒
    template_expenses_remind:  pZby4Mz3H5angmjGTuvXzo9lwlaVfEiqORwI8soI-5E
    #健康教育
    template_healthy_article: aO_qqk5nAXaGXhsikPVLNelqzwlrp1LTPfIQ1qRMpxo
    #医生变更
    template_doctor_change:  V5h0F84t972kUzQvWy8qYrgdaYGJVj10pFeFVl19Nb8
    #问卷调查
    template_doctor_survey:  OqQXrb-e43_TJpq_70_K_y6vYJgY5mpjFYY4c5RWFP4
    #审核结果通知
    template_doctor_audit:  lCtOgJgL1tBJbAytqN7cn-FgCH_Usg99FENEy2TrC08
    #服务结果通知
    template_doctor_service: i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw
   ##处方待处理提醒
   template_prescription_pending: aPl14500g7SblWWGBsisRgFGqtSskiGxmhGMD5tS9ik
   ##服务状态提醒
   template_consult_notice: 5eOa_Wx60tqsbuQK7ITTgRXB-8SntBONvopai_HFnhY
   #居民体征异常提醒
   template_abnormal_signs: 5i4OuDef0Bzk3SBD9iuhOGqoCH0OSaH3HYIC8Sgg-yA
   #咨询请求通知
   template_consult_request: TeiAPgxC7JTVfWa24fkemlJ8Nvji_NCPYmxKzXql05A
   #签约申请通知
   template_sign_request: 7zB0Qf4nUEZlkGnoElmx8I4Q5dm0Gq9JZP6PCzl9b7s
   #随访提醒
   template_followup_success: -9blCMt1b7t24biL7QbkmQH0KWLgOIDQ5LtyX_Ai49E
   #处理结果通知
   template_treatment_result: J3W3-ZGZ5miHd0Ka1JLaXCYkIoCdiuJ-c527PH5nPQI
   #咨询回复提醒
   template_consult_reply: x7fIXWcd1YsXAnwhP-gmW1D__GtzD39j5KZLudoe0Y0
   #代办事项提醒
   template_schedule_remind: z32DERzD6X4ShOl86sI3YCOWl-lkr5Z9sKh1w_YG8Bs
yihu:

+ 21 - 31
patient-co/patient-co-doctor-assistant/src/main/resources/application-local.yml

@ -26,40 +26,30 @@ im:
  data_base_name: im_new
wechat:
  appId: wx1f129f7b51701428
  appSecret: 988f005d8309ed1795939e0f042431fb
  appId: wxb3827510b2e15012
  appSecret: c5bdedd909ded9c2ee08028487e6f50d
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fehr.yihu.com%2fwlyy
  accId: gh_ffd64560fb21
  accId: gh_aa9cd602b84b
  message:
    ##医生追加建议提醒 --签约邀请
    doctor_invitel_template:  uXdBJVbrhKG-WLaCG4s8C4SXSr2kknQ94vKFt-3rIiA
    #咨询回复
    template_consult_notice: dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18
    #签约成功
    template_sign_success: VYGj8OUKj6FH4i4_nZS2UAHurJxQHx-7_OBPILIdB8s
    #签约失败
    template_sign_failed: m221Jrkm0UUY00ExTCpQNTB8t_1U_V4LR9Bg8BgH9-o
    #健康指导提醒
    template_health_notice: 5Nts8lA_at9Cd1JuTK-qDxx95lchpcmUfPTEwYDgXYQ
    #解约提醒
    template_termination:  qZm1NwSueAsbHaOf9DrnLoSj0X5gZuh9W7aDYzLWNds
    #预约成功
    template_appoint_success:  vU5x2tGyk1zUngBrEqMfnFqqMa6M8J98w8k5MCSUYM
    #预约取消
    template_appoint_failed:  r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
    #缴费提醒
    template_expenses_remind:  pZby4Mz3H5angmjGTuvXzo9lwlaVfEiqORwI8soI-5E
    #健康教育
    template_healthy_article: aO_qqk5nAXaGXhsikPVLNelqzwlrp1LTPfIQ1qRMpxo
    #医生变更
    template_doctor_change:  V5h0F84t972kUzQvWy8qYrgdaYGJVj10pFeFVl19Nb8
    #问卷调查
    template_doctor_survey:  OqQXrb-e43_TJpq_70_K_y6vYJgY5mpjFYY4c5RWFP4
    #审核结果通知
    template_doctor_audit:  lCtOgJgL1tBJbAytqN7cn-FgCH_Usg99FENEy2TrC08
    #服务结果通知
    template_doctor_service: i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw
    ##处方待处理提醒
    template_prescription_pending: aPl14500g7SblWWGBsisRgFGqtSskiGxmhGMD5tS9ik
    ##服务状态提醒
    template_consult_notice: 5eOa_Wx60tqsbuQK7ITTgRXB-8SntBONvopai_HFnhY
    #居民体征异常提醒
    template_abnormal_signs: 5i4OuDef0Bzk3SBD9iuhOGqoCH0OSaH3HYIC8Sgg-yA
    #咨询请求通知
    template_consult_request: TeiAPgxC7JTVfWa24fkemlJ8Nvji_NCPYmxKzXql05A
    #签约申请通知
    template_sign_request: 7zB0Qf4nUEZlkGnoElmx8I4Q5dm0Gq9JZP6PCzl9b7s
    #随访提醒
    template_followup_success: -9blCMt1b7t24biL7QbkmQH0KWLgOIDQ5LtyX_Ai49E
    #处理结果通知
    template_treatment_result: J3W3-ZGZ5miHd0Ka1JLaXCYkIoCdiuJ-c527PH5nPQI
    #咨询回复提醒
    template_consult_reply: x7fIXWcd1YsXAnwhP-gmW1D__GtzD39j5KZLudoe0Y0
    #代办事项提醒
    template_schedule_remind: z32DERzD6X4ShOl86sI3YCOWl-lkr5Z9sKh1w_YG8Bs
yihu:

+ 21 - 31
patient-co/patient-co-doctor-assistant/src/main/resources/application-localtest.yml

@ -26,40 +26,30 @@ im:
  data_base_name: im_new
wechat:
  appId: wx1f129f7b51701428
  appSecret: 988f005d8309ed1795939e0f042431fb
  appId: wxb3827510b2e15012
  appSecret: c5bdedd909ded9c2ee08028487e6f50d
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fehr.yihu.com%2fwlyy
  accId: gh_ffd64560fb21
  accId: gh_aa9cd602b84b
  message:
    ##医生追加建议提醒 --签约邀请
    doctor_invitel_template:  uXdBJVbrhKG-WLaCG4s8C4SXSr2kknQ94vKFt-3rIiA
    #咨询回复
    template_consult_notice: dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18
    #签约成功
    template_sign_success: VYGj8OUKj6FH4i4_nZS2UAHurJxQHx-7_OBPILIdB8s
    #签约失败
    template_sign_failed: m221Jrkm0UUY00ExTCpQNTB8t_1U_V4LR9Bg8BgH9-o
    #健康指导提醒
    template_health_notice: 5Nts8lA_at9Cd1JuTK-qDxx95lchpcmUfPTEwYDgXYQ
    #解约提醒
    template_termination:  qZm1NwSueAsbHaOf9DrnLoSj0X5gZuh9W7aDYzLWNds
    #预约成功
    template_appoint_success:  vU5x2tGyk1zUngBrEqMfnFqqMa6M8J98w8k5MCSUYM
    #预约取消
    template_appoint_failed:  r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
    #缴费提醒
    template_expenses_remind:  pZby4Mz3H5angmjGTuvXzo9lwlaVfEiqORwI8soI-5E
    #健康教育
    template_healthy_article: aO_qqk5nAXaGXhsikPVLNelqzwlrp1LTPfIQ1qRMpxo
    #医生变更
    template_doctor_change:  V5h0F84t972kUzQvWy8qYrgdaYGJVj10pFeFVl19Nb8
    #问卷调查
    template_doctor_survey:  OqQXrb-e43_TJpq_70_K_y6vYJgY5mpjFYY4c5RWFP4
    #审核结果通知
    template_doctor_audit:  lCtOgJgL1tBJbAytqN7cn-FgCH_Usg99FENEy2TrC08
    #服务结果通知
    template_doctor_service: i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw
    ##处方待处理提醒
    template_prescription_pending: aPl14500g7SblWWGBsisRgFGqtSskiGxmhGMD5tS9ik
    ##服务状态提醒
    template_consult_notice: 5eOa_Wx60tqsbuQK7ITTgRXB-8SntBONvopai_HFnhY
    #居民体征异常提醒
    template_abnormal_signs: 5i4OuDef0Bzk3SBD9iuhOGqoCH0OSaH3HYIC8Sgg-yA
    #咨询请求通知
    template_consult_request: TeiAPgxC7JTVfWa24fkemlJ8Nvji_NCPYmxKzXql05A
    #签约申请通知
    template_sign_request: 7zB0Qf4nUEZlkGnoElmx8I4Q5dm0Gq9JZP6PCzl9b7s
    #随访提醒
    template_followup_success: -9blCMt1b7t24biL7QbkmQH0KWLgOIDQ5LtyX_Ai49E
    #处理结果通知
    template_treatment_result: J3W3-ZGZ5miHd0Ka1JLaXCYkIoCdiuJ-c527PH5nPQI
    #咨询回复提醒
    template_consult_reply: x7fIXWcd1YsXAnwhP-gmW1D__GtzD39j5KZLudoe0Y0
    #代办事项提醒
    template_schedule_remind: z32DERzD6X4ShOl86sI3YCOWl-lkr5Z9sKh1w_YG8Bs
yihu:

+ 21 - 31
patient-co/patient-co-doctor-assistant/src/main/resources/application-test.yml

@ -25,40 +25,30 @@ im:
  data_base_name: im_new
wechat:
  appId: wx088a4d8e8208e6ce
  appSecret: ab3cdd509fb76fd0149e8864c97e8ddb
  appId: wxb3827510b2e15012
  appSecret: c5bdedd909ded9c2ee08028487e6f50d
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fwww.xmtyw.cn%2fassistant
  accId: gh_b0f086d0d2f5
  accId: gh_aa9cd602b84b
  message:
   ##医生追加建议提醒 --签约邀请
   doctor_invitel_template: uXdBJVbrhKG-WLaCG4s8C4SXSr2kknQ94vKFt-3rIiA
   #咨询回复
   template_consult_notice: dr4QNyFoRvVsf8uWxXMC1dRyjwnbUuJwJ21vBLhf18
   #签约成功
   template_sign_success: VYGj8OUKj6FH4i4_nZS2UAHurJxQHx-7_OBPILIdB8s
   #签约失败
   template_sign_failed: m221Jrkm0UUY00ExTCpQNTB8t_1U_V4LR9Bg8BgH9-o
   #健康指导提醒
   template_health_notice: 5Nts8lA_at9Cd1JuTK-qDxx95lchpcmUfPTEwYDgXYQ
   #解约提醒
   template_termination:  qZm1NwSueAsbHaOf9DrnLoSj0X5gZuh9W7aDYzLWNds
   #预约成功
   template_appoint_success:  vU5x2tGyk1zUngBrEqMfnFqqMa6M8J98w8k5MCSUYM
   #预约取消
   template_appoint_failed:  r-bVEKgXVyl8O96saoJXlLd7DX1zW7fXA4a0PZHxiQM
   #缴费提醒
   template_expenses_remind:  pZby4Mz3H5angmjGTuvXzo9lwlaVfEiqORwI8soI-5E
   #健康教育
   template_healthy_article: aO_qqk5nAXaGXhsikPVLNelqzwlrp1LTPfIQ1qRMpxo
   #医生变更
   template_doctor_change:  V5h0F84t972kUzQvWy8qYrgdaYGJVj10pFeFVl19Nb8
   #问卷调查
   template_doctor_survey:  OqQXrb-e43_TJpq_70_K_y6vYJgY5mpjFYY4c5RWFP4
   #审核结果通知
   template_doctor_audit:  lCtOgJgL1tBJbAytqN7cn-FgCH_Usg99FENEy2TrC08
   #服务结果通知
   template_doctor_service:  i34rq3xFLnpf_VN2Jor9n2YlQqJMM7oXyYvuctriISw
     ##处方待处理提醒
     template_prescription_pending: aPl14500g7SblWWGBsisRgFGqtSskiGxmhGMD5tS9ik
     ##服务状态提醒
     template_consult_notice: 5eOa_Wx60tqsbuQK7ITTgRXB-8SntBONvopai_HFnhY
     #居民体征异常提醒
     template_abnormal_signs: 5i4OuDef0Bzk3SBD9iuhOGqoCH0OSaH3HYIC8Sgg-yA
     #咨询请求通知
     template_consult_request: TeiAPgxC7JTVfWa24fkemlJ8Nvji_NCPYmxKzXql05A
     #签约申请通知
     template_sign_request: 7zB0Qf4nUEZlkGnoElmx8I4Q5dm0Gq9JZP6PCzl9b7s
     #随访提醒
     template_followup_success: -9blCMt1b7t24biL7QbkmQH0KWLgOIDQ5LtyX_Ai49E
     #处理结果通知
    template_treatment_result: J3W3-ZGZ5miHd0Ka1JLaXCYkIoCdiuJ-c527PH5nPQI
     #咨询回复提醒
     template_consult_reply: x7fIXWcd1YsXAnwhP-gmW1D__GtzD39j5KZLudoe0Y0
     #代办事项提醒
     template_schedule_remind: z32DERzD6X4ShOl86sI3YCOWl-lkr5Z9sKh1w_YG8Bs
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/

+ 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;

+ 120 - 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,138 @@ 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.poolPreparedStatements}")
    private boolean poolPreparedStatements;
    @Value("${spring.datasource.maxPoolPreparedStatementPerConnectionSize}")
    private int maxPoolPreparedStatementPerConnectionSize;
    @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);
        datasource.setPoolPreparedStatements(poolPreparedStatements);
        datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
        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);
        datasource.setPoolPreparedStatements(poolPreparedStatements);
        datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
        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);
        datasource.setPoolPreparedStatements(poolPreparedStatements);
        datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
        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);
    }
}

+ 17 - 4
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/AgeConvert.java

@ -9,7 +9,10 @@ import com.yihu.wlyy.statistics.vo.DataModel;
import com.yihu.wlyy.statistics.vo.WlyyJobConfigVO;
import org.springframework.jdbc.core.JdbcTemplate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2017/6/5.
@ -20,18 +23,28 @@ public class AgeConvert implements Convert {
     * @param slaveLevel 从1开始
     * @return
     */
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List oneList, String slaveLevel, WlyyDimensionQuota temp ) {
        oneList.stream().forEach(one -> {
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List<DataModel> oneList, String slaveLevel, WlyyDimensionQuota temp ) {
        Map<String,Object> tempMap = new HashMap<>();
        List<DataModel> result = new ArrayList<>();
        for(DataModel one:oneList) {
            try {
                Object value = DataModel.class.getMethod("get" + temp.getKey()).invoke(one);
                Integer age= IdCardUtil.getAgeForIdcard(String.valueOf(value));
                String key = getAgeCode(age);
                if("63".equals(temp.getQuotaCode())){
                    if(tempMap.containsKey(String.valueOf(value))){
                        continue;
                    }
                }
                tempMap.put(String.valueOf(value),one);
                DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(one, key);
                result.add(one);
            } catch (Exception e) {
                e.printStackTrace();
            }
        });
        return oneList;
        };
        return result;
    }
    public String getAgeCode(Integer age) {

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

@ -24,6 +24,7 @@ public class DiseaseConvert implements Convert {
        List<DataModel> returnList = new ArrayList<>();
        //初始化标签Map
//        Map<String, Object> map = initHealthLabesMap(jdbcTemplate, temp);
        Map<String,Object> tempMap = new HashMap<>();
        //把标签Map设置到对应的维度里面
        List<String> keyList = null;
        for(DataModel one:oneList){
@ -32,9 +33,17 @@ public class DiseaseConvert implements Convert {
                for(String key:keyList){
                    DataModel dataModelTemp = new DataModel();
                    BeanUtils.copyProperties(one, dataModelTemp);
                    if("63".equals(temp.getQuotaCode())){
                        if(tempMap.containsKey(String.valueOf(one.getPatient()))){
                            continue;
                        }
                        tempMap.put(String.valueOf(one.getPatient()),one);
                    }
                    DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(dataModelTemp, key);
                    returnList.add(dataModelTemp);
                }
            }catch (Exception e) {
                e.printStackTrace();
            }

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

@ -38,7 +38,7 @@ public class PrescriptionStatusConvert implements Convert {
    }
    public String getStatusCode(Integer status) {
        if (status >= 0 && status <= 100) {
        if (status >= 0 && status < 100) {
            return Contant.prescriptionStatus.status_1;
        } else if (status==100) {
            return Contant.prescriptionStatus.status_2;
@ -46,7 +46,7 @@ public class PrescriptionStatusConvert implements Convert {
            return Contant.prescriptionStatus.status_3;
        } else if (status==-1) {
            return Contant.prescriptionStatus.status_4;
        } else if (status==-3) {
        } else if (status==-3||status==-4||status==-5) {
            return Contant.prescriptionStatus.status_5;
        } else{
            return "0";

+ 1 - 2
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/extract/db/DBExtract.java

@ -16,6 +16,7 @@ import java.util.List;
@Component
@Scope("prototype")
public class DBExtract<T> {
    Integer pageSize=100000;
    /**
     * 不分页抽取
@ -49,7 +50,6 @@ public class DBExtract<T> {
        if(StringUtils.isEmpty(countSql)){
            return extract(clazz,sql,jdbcTemplate);
        }
        int pageSize=10000;
        return SpringUtil.getBean(DBPageExtract.class).extractByPage(clazz,sql,countSql,pageSize,isMultithreading,jdbcTemplate);
    }
    /**
@ -59,7 +59,6 @@ public class DBExtract<T> {
     * @return
     */
    public List<Object> extractByPage(Class<T> clazz,String sql,JdbcTemplate jdbcTemplate)throws  Exception{
        int pageSize=10000;
        Boolean isMultithreading=false;
        String countSql="";
        return SpringUtil.getBean(DBPageExtract.class).extractByPage(clazz,sql,countSql,pageSize,isMultithreading,jdbcTemplate);

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

@ -14,6 +14,8 @@ import com.yihu.wlyy.statistics.vo.WlyyJobConfigVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -42,6 +44,9 @@ public class JobService {
    @Autowired
    private DoctorPatientGroupInfoDao doctorPatientGroupInfoDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Transactional
    public void stopById(String id) throws Exception {
@ -170,6 +175,7 @@ public class JobService {
    }
    public void productDataByOneDay(String yesterday) throws Exception {
        String sql="select * from wlyy_job_config_new a where  a.del='1' and a.id !=11 order by a.id asc";
        SimpleDateFormat dataSimple = new SimpleDateFormat("yyyy-MM-dd");
        Date date = dataSimple.parse(yesterday);
@ -181,7 +187,7 @@ public class JobService {
        calendar.add(calendar.DATE, -1);//把日期往后增加一天.整数往后推,负数往前移动
        Date nowDate = calendar.getTime();   //这个时间就是日期往后推一天的结果
        String daybefore = new SimpleDateFormat("yyyy-MM-dd").format(nowDate.getTime());
        List<QuartzJobConfig> quartzJobConfigs = wlyyJobConfigDao.findByIds();
        List<QuartzJobConfig> quartzJobConfigs = jdbcTemplate.query(sql,new BeanPropertyRowMapper(QuartzJobConfig.class));
        for (QuartzJobConfig quartzJobConfig : quartzJobConfigs) {
            WlyyJobConfigVO wlyyJobConfigVO = new WlyyJobConfigVO();
@ -300,6 +306,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));
        }
    }

+ 5 - 5
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/IdCardUtil.java

@ -63,27 +63,27 @@ public class IdCardUtil {
    public static String getSexForIdcard(String CardCode)
            throws Exception {
        try {
            String sex = "1";
            String sex = "2";
            if (CardCode.length() == 18) {
                if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
                    // modifid by lyr 2016-09-29
                    // sex =  Constant.level_sex_2;
                    sex = "2";
                    sex = "1";
                    // modifid by lyr 2016-09-29
                } else {
                    // modifid by lyr 2016-09-29
                    // sex =  Constant.level_sex_1;
                    sex = "1";
                    sex = "2";
                    // modifid by lyr 2016-09-29
                }
            } else if (CardCode.length() == 15) {
                String usex = CardCode.substring(14, 15);// 用户的性别
                if (Integer.parseInt(usex) % 2 == 0) {
                    // sex =  Constant.level_sex_2;
                    sex = "2";
                    sex = "1";
                } else {
                    // sex =  Constant.level_sex_1;
                    sex = "1";
                    sex = "2";
                }
            }
            return sex;

+ 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库:

+ 18 - 52
patient-co/patient-co-statistics-es/src/main/resources/application.yml

@ -13,58 +13,19 @@ 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: 50
    maxActive: 50
    minIdle: 50 #最大空闲连接
    maxWait: 50
    validationQuery: SELECT 1 #SQL 查询, 用来验证从连接池取出的连接, 在将连接返回给调用者之前。 如果指定, 则查询必须是一个SQL SELECT 并且必须返回至少一行记录
    testOnBorrow: true #指明是否在从池中取出连接前进行检验, 如果检验失败, 则从池中去除连接并尝试取出另一个。注意: 设置为true 后如果要生效,validationQuery 参数必须设置为非空字符串
    testOnReturn: true #指明是否在归还到池中前进行检验 注意: 设置为true 后如果要生效validationQuery 参数必须设置为非空字符串
    testWhileIdle: true #指明连接是否被空闲连接回收器(如果有)进行检验,如果检测失败,则连接将被从池中去除
    minEvictableIdleTimeMillis: 3600000 #连接池中连接,在时间段内一直空闲,被逐出连接池的时间(1000*60*60),以毫秒为单位
    timeBetweenEvictionRunsMillis: 300000 #在空闲连接回收器线程运行期间休眠的时间值,以毫秒为单位,一般比minEvictableIdleTimeMillis小
    poolPreparedStatements: true # 打开PSCache,并且指定每个连接上PSCache的大小
    maxPoolPreparedStatementPerConnectionSize: 50
    # REDIS
  redis:
    database: 0 # Database index used by the connection factory.
@ -97,6 +58,11 @@ logging:
  level:
    root: INFO
hibernate:
  dialect: org.hibernate.dialect.MySQL5Dialect
  show_sql: false
  ejb:
    naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy
JobService:
  sleepTime: 30000

+ 0 - 1
patient-co/patient-co-wlyy/pom.xml

@ -10,7 +10,6 @@
        <relativePath>../../patient-co-lib/pom.xml</relativePath>
    </parent>
    <artifactId>patient-co-wlyy</artifactId>
    <name>patient-co-wlyy</name>
    <version>1.0.0</version>

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

@ -180,7 +180,8 @@ public class SwaggerConfig {
                        regex("/express/.*"),
                        regex("/doctorFeedback/.*"),
                        regex("/patientFeedback/.*"),
                        regex("/esstatistics/.*")
                        regex("/esstatistics/.*"),
                        regex("/old/statistics/.*")
                ))
                .build()
                .apiInfo(otherApiInfo());

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

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

@ -75,5 +75,5 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    
    @Modifying
    @Query("update Followup a set a.status=?2 where a.prescriptionCode = ?1 ")
    void updateStatusByPrescriptionCode(String prescriptionCode, Integer status);
    void updateStatusByPrescriptionCode(String prescriptionCode, String status);
}

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

+ 26 - 29
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,36 +909,29 @@ public class PatientHealthIndexService extends BaseService {
     */
    private void sendPrescriptionHealthIndexMsgresult(DevicePatientHealthIndex result, Patient patient) {
        
        List<ConsultTeam> consultTeams = consultTeamDao.findUnfinishedConsult(patient.getCode());
        
        if(1 == result.getType()){
            for (ConsultTeam consultTeam:consultTeams) {
                if(1 == consultTeam.getHealthindexType() || 3 == consultTeam.getHealthindexType()){
                    org.json.JSONObject contentPatient = new org.json.JSONObject();
                    //患者发送的消息
                    contentPatient.put("title", "【本消息为系统提醒】:");
                    contentPatient.put("tzMsg", "体征记录:血糖 "+result.getValue1());
                    contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                    contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以自动填入本次随访记录");
                    //患者发送Im消息
                    ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);
                }
            }
        }else if(2 == result.getType()){
            for (ConsultTeam consultTeam:consultTeams) {
                if(2 == consultTeam.getHealthindexType() || 3 == consultTeam.getHealthindexType()){
                    org.json.JSONObject contentPatient = new org.json.JSONObject();
                    //患者发送的消息
                    contentPatient.put("title", "【本消息为系统提醒】:");
        List<ConsultTeam> consultTeams = consultTeamDao.findUnfinishedConsultPrescription(patient.getCode());
    
        for (ConsultTeam consultTeam:consultTeams) {
            if(consultTeam.getHealthindexType() != null){
                org.json.JSONObject contentPatient = new org.json.JSONObject();
                //患者发送的消息
                contentPatient.put("title", "【本消息为系统提醒】:");
                if(1 == result.getType()){
                    contentPatient.put("tzMsg", "体征记录:血糖 "+result.getValue1()+" mmol/L");
                    contentPatient.put("type",2);
                }else if(2 == result.getType()){
                    contentPatient.put("tzMsg", "体征记录:血压 "+result.getValue1()+"/"+result.getValue2()+" mmHg");
                    contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                    contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以自动填入本次随访记录");
                    //患者发送Im消息
                    ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);
                }
                    contentPatient.put("type",1);
                }else{}
                
                contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
                contentPatient.put("needUpload","false");
                
                //患者发送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){

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

@ -652,10 +652,10 @@ public class PrescriptionInfoService extends BaseService {
                //获取智业待结算接口,更新药品金额
                prescriptionService.getPerscriptionInfoCostFromPayInfo(p.getCode());
                
                //更新随访记录的状态为完成
                followUpDao.updateStatusByPrescriptionCode(p.getCode(),1);
                
                followUpDao.updateStatusByPrescriptionCode(p.getCode(),"1");
                //发送Im消息
                JSONObject content = new JSONObject();
                content.put("title", "我已经审核您" + DateUtil.dateToStr(p.getCreateTime(), "yyyy-MM-dd") + "发起的续方申请");
@ -883,8 +883,8 @@ public class PrescriptionInfoService extends BaseService {
                p.setJwDeptCode(dept);
                p.setJwRegisterFee(registerFee);
                p.setJwGisterTypeCode(rateTypeCode);//挂号类型
                
                
            } else {
                //审核不通过
                p.setStatus(PrescriptionLog.PrescriptionLogStatus.no_reviewed.getValue());

+ 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";

+ 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,"添加失败");

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackTemplateController.java

@ -42,9 +42,10 @@ public class DoctorFeedbackTemplateController extends BaseController {
    public String saveFeedback(
            @RequestParam String receiver,
            @RequestParam String title,
            @RequestParam String type,
            @RequestParam String content) {
        try {
            pushMsgTask.put(receiver, "8", title, content, "");
            pushMsgTask.put(receiver, type, title, content, "");
            return write(200, "发送成功!");
        } catch (Exception e) {
            error(e);

+ 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());

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

@ -1455,7 +1455,7 @@ public class EsStatisticsController extends BaseController {
     * <p>
     * @param index 42,43,44 (52,53,54 服务类型维度)
     * @param level 等级  4 市  3区  2社区 1团队
     * @param area  市 默认是厦门市 350200  区 就是区的code  社区就是社区的code 团队就是团队的code.
     * @param code  市 默认是厦门市 350200  区 就是区的code  社区就是社区的code 团队就是团队的code.
     * @param year  年份 非比传
     * @param lowCode 服务类型维度code(老年人3,高血压1,糖尿病2)
     * @return
@ -1465,7 +1465,7 @@ public class EsStatisticsController extends BaseController {
    public String getRenewPercentAndChangePercent(
            @RequestParam(required = true) String index,//续签index
            @RequestParam(required = true) int level,
            @RequestParam(required = true) String area,
            @RequestParam(required = true) String code,
            @RequestParam(required = false) String year,
            @RequestParam(required = false) String lowCode) {
        try {
@ -1474,7 +1474,7 @@ public class EsStatisticsController extends BaseController {
                year = Constant.getNowYear();
            }*/
            //return write(200, "查询成功", "data", statisticsService.getRenewPercentAndChangePercent(index,level, code, year,lowCode));
            return write(200,"查询成功!","data",statisticsESService.getRenewPercentAndChangePercent(index,elasticsearchUtil.changeLevel(level),area,year,lowCode));
            return write(200,"查询成功!","data",statisticsESService.getRenewPercentAndChangePercent(index,elasticsearchUtil.changeLevel(level),code,year,lowCode));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/service/GcEduArticleService.java

@ -1,7 +1,9 @@
package com.yihu.wlyy.web.third.gateway.service;
import com.yihu.es.entity.ArticleTest;
import com.yihu.wlyy.config.es.ElastricSearchSave;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.education.HealthEduArticlePatientDao;
@ -288,4 +290,18 @@ public class GcEduArticleService {
        List<String> groupPatient = jdbcTemplate.queryForList(tableSql+whereSql, String.class);
        patientSet.addAll(groupPatient);
    }
    @Transactional
    public void getSaveArticle(){
//        ArticleTest aa = new ArticleTest();
//        Patient pa = new Patient();
//        String batchNo = UUID.randomUUID().toString();
//        pa.setCode(batchNo);
//        pa.setCity("1212");
//        pa.setName("hukun");
//        batchNo = UUID.randomUUID().toString();
//        aa.setBatchNo(batchNo);
//        aa.setPatients(pa);
    }
}

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

@ -460,13 +460,13 @@ public class EduDoctorArticleController extends BaseController{
    }
//    @RequestMapping(value = "/sendPatients", method = RequestMethod.POST)
//    @ResponseBody
//    @ApiOperation("文章群推送")
//    public void saveArticle(){
//
//
//    }
    @RequestMapping(value = "/saveArticle", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("测试生成数据")
    public void saveArticle(){
    }
    /**
     * 获取要推送的患者

+ 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