Browse Source

客服系統

trick9191 7 years ago
parent
commit
5dd7db625f
100 changed files with 1459 additions and 919 deletions
  1. 6 0
      common/common-entity/pom.xml
  2. 89 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/application/Application.java
  3. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/dict/Icd10Dict.java
  4. 7 50
      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. 49 47
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Message.java
  7. 7 4
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/AppealService.java
  8. 5 2
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/FeedbackService.java
  9. 1 1
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  10. 18 25
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  11. 0 60
      patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/doctor/template/DoctorFeldsherTemplateController.java
  12. 56 0
      patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/third/template/WlyyFeldsherTemplateController.java
  13. 21 31
      patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml
  14. 21 31
      patient-co/patient-co-doctor-assistant/src/main/resources/application-devtest.yml
  15. 21 31
      patient-co/patient-co-doctor-assistant/src/main/resources/application-local.yml
  16. 21 31
      patient-co/patient-co-doctor-assistant/src/main/resources/application-localtest.yml
  17. 21 31
      patient-co/patient-co-doctor-assistant/src/main/resources/application-test.yml
  18. 11 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/config/DataSourceConfig.java
  19. 9 3
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/controller/QueryController.java
  20. 17 4
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/AgeConvert.java
  21. 14 3
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DiseaseConvert.java
  22. 2 2
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/PrescriptionStatusConvert.java
  23. 1 2
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/extract/db/DBExtract.java
  24. 31 15
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/es/ElasticFactory.java
  25. 16 4
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/save/es/ElastricSearchSave.java
  26. 17 11
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/CurrentMysqlToEsQuotaJob.java
  27. 8 3
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/MysqlToEsQuotaJob.java
  28. 16 6
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/service/ExtractDataService.java
  29. 9 2
      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. 9 1
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/vo/DataModel.java
  32. 2 3
      patient-co/patient-co-statistics-es/src/main/resources/application-dev.yml
  33. 2 3
      patient-co/patient-co-statistics-es/src/main/resources/application-devtest.yml
  34. 2 3
      patient-co/patient-co-statistics-es/src/main/resources/application-prod.yml
  35. 2 3
      patient-co/patient-co-statistics-es/src/main/resources/application-test.yml
  36. 5 4
      patient-co/patient-co-statistics-es/src/main/resources/application.yml
  37. 2 2
      patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/model/job/QuartzJobLog.java
  38. 8 8
      patient-co/patient-co-statistics/src/main/resources/application.yml
  39. 41 29
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/es/ElasticFactory.java
  40. 31 26
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/es/ElastricSearchSave.java
  41. 3 1
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/third/jw/JwPrescriptionService.java
  42. 2 3
      patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml
  43. 2 3
      patient-co/patient-co-wlyy-job/src/main/resources/application-devtest.yml
  44. 2 3
      patient-co/patient-co-wlyy-job/src/main/resources/application-prod.yml
  45. 2 3
      patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml
  46. 0 1
      patient-co/patient-co-wlyy/pom.xml
  47. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  48. 34 22
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/es/ElasticFactory.java
  49. 8 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/es/ElastricSearchSave.java
  50. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/interceptors/EncodingFilter.java
  51. 19 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/application/ApplicationDao.java
  52. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SignPatientLabelDao.java
  53. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java
  54. 49 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/application/ApplicationService.java
  55. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  56. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/ehc/PatientEHCService.java
  57. 138 104
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java
  58. 19 30
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  59. 8 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java
  60. 6 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionInfoService.java
  61. 4 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  62. 235 138
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  63. 7 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java
  64. 62 19
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java
  65. 15 17
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java
  66. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/area/AreaController.java
  67. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/device/DeviceController.java
  68. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/health/HealthEduArticlesController.java
  69. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/hospital/HospitalCommonController.java
  70. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/icd/Icd10Controller.java
  71. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java
  72. 9 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/qrcode/QrCodeController.java
  73. 3 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/CaptchaController.java
  74. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java
  75. 8 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java
  76. 1 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/verified/VerifiedController.java
  77. 7 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java
  78. 38 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/application/ApplicationController.java
  79. 7 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/archives/DoctorArchivesController.java
  80. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/booking/DoctorBookingController.java
  81. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultMoviController.java
  82. 8 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java
  83. 17 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/discussion/DoctorDiscussionGroupController.java
  84. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/family/DoctorFamilyController.java
  85. 2 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackTemplateController.java
  86. 2 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prenatalInspector/PrenatalController.java
  87. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/reply/DoctorQuickReplyController.java
  88. 5 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheduling/DoctorWorkTimeController.java
  89. 9 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  90. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java
  91. 17 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/service/GcEduArticleService.java
  92. 7 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduDoctorArticleController.java
  93. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/zysoft/BookingController.java
  94. 30 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/wx/OnePayController.java
  95. 2 3
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml
  96. 2 3
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  97. 2 3
      patient-co/patient-co-wlyy/src/main/resources/application-local.yml
  98. 2 3
      patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml
  99. 2 3
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  100. 0 0
      patient-co/patient-co-wlyy/src/main/resources/application-test.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>

+ 89 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/application/Application.java

@ -0,0 +1,89 @@
package com.yihu.wlyy.entity.application;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 应用表
 * Created by yeshijie on 2017/11/13.
 */
@Entity
@Table(name = "wlyy_application")
public class Application extends IdEntity{
    String code;//应用code
    String type;//类型(1pcim,)
    String name;//应用名称
    String icon;//应用图标
    String url;//链接地址
    String hospitals;//有权限访问的机构(如果为空,则都可以访问,否则,以逗号分隔可以访问的机构)
    String del;//删除标志(1正常,0删除)
    Date createTime;//创建时间
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getIcon() {
        return icon;
    }
    public void setIcon(String icon) {
        this.icon = icon;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public String getHospitals() {
        return hospitals;
    }
    public void setHospitals(String hospitals) {
        this.hospitals = hospitals;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/dict/Icd10Dict.java

@ -14,7 +14,7 @@ public class Icd10Dict {
    private String code;//'icd10字典编码'
    private String name;//'icd10字典名称'
    private String phoneticCode;//字典名称拼音首字母
    private String chronicFlag;//是否慢病
    private String chronicFlag;//是否慢病 1是,0或null为否
    private String infectiousFlag;//是否传染病
    private String description;//'描述'
    private String createUser;

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

@ -1,14 +1,17 @@
package com.yihu.wlyy.entity.job;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
/**
 * 计划任务
 */
@Entity
@Table(name = "wlyy_job_config_cwd")
@Table(name = "wlyy_job_config")
public class QuartzJobConfig implements java.io.Serializable {
	private String id;
@ -20,11 +23,6 @@ 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() {
@ -33,7 +31,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;
@ -126,45 +124,4 @@ public class QuartzJobConfig implements java.io.Serializable {
	public void setDel(String del) {
		this.del = del;
	}
	public String getSql() {
		return sql;
	}
	public void setSql(String sql) {
		this.sql = sql;
	}
	public String getSqlCount() {
		return sqlCount;
	}
	public void setSqlCount(String sqlCount) {
		this.sqlCount = sqlCount;
	}
	public String getSqlDay() {
		return sqlDay;
	}
	public void setSqlDay(String sqlDay) {
		this.sqlDay = sqlDay;
	}
	public String getSqlYear() {
		return sqlYear;
	}
	public void setSqlYear(String sqlYear) {
		this.sqlYear = sqlYear;
	}
	public String getCacheKey() {
		return cacheKey;
	}
	public void setCacheKey(String cacheKey) {
		this.cacheKey = cacheKey;
	}
}

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


File diff suppressed because it is too large
+ 49 - 47
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/Message.java


+ 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(appeal.getCode());
                //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.getCode());
                //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");

+ 1 - 1
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/
---

+ 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, "发送失败!");
        }
    }
}

+ 56 - 0
patient-co/patient-co-doctor-assistant/src/main/java/com/yihu/wlyy/web/third/template/WlyyFeldsherTemplateController.java

@ -0,0 +1,56 @@
package com.yihu.wlyy.web.third.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 = "/wlyy/feldsher")
@Api(description = "医生助手模板")
public class WlyyFeldsherTemplateController extends BaseController {
    @Autowired
    private DoctorFeldsherTemplateService feldsherTemplateService;
    /**
     * i健康往医生助手 医生端推送模板消息
     *
     * @param type 消息类型
     * @param openId
     * @param url
     * @param first
     * @param remark
     * @param keywords
     * @return
     */
    @RequestMapping(value = "/sendDoctorTemplates", method = RequestMethod.POST)
    @ApiOperation(value = "医生助手给医生发送模板消息")
    public String sendDoctorTemplates(@RequestParam @ApiParam(value = "模板类型",required = true) int type,
                                      @RequestParam @ApiParam(value = "openId", required = true) String openId,
                                      @RequestParam @ApiParam(value = "跳转链接", required = true) String url,
                                      @RequestParam @ApiParam(value = "消息头",required = true) String first,
                                      @RequestParam @ApiParam(value = "消息尾", required = true,defaultValue = "") String remark,
                                      @RequestParam @ApiParam(value = "消息体",required = true) String ... keywords) {
        try {
            feldsherTemplateService.sendDoctorTemplates(type, openId, url, first, remark, keywords);
            return write(200, "发送成功!");
        } 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/

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

@ -40,6 +40,10 @@ public class DataSourceConfig {
    private boolean testOnBorrow;
    @Value("${spring.datasource.testOnReturn}")
    private boolean testOnReturn;
    @Value("${spring.datasource.poolPreparedStatements}")
    private boolean poolPreparedStatements;
    @Value("${spring.datasource.maxPoolPreparedStatementPerConnectionSize}")
    private int maxPoolPreparedStatementPerConnectionSize;
@ -75,6 +79,9 @@ public class DataSourceConfig {
        datasource.setTestWhileIdle(testWhileIdle);
        datasource.setTestOnBorrow(testOnBorrow);
        datasource.setTestOnReturn(testOnReturn);
        datasource.setPoolPreparedStatements(poolPreparedStatements);
        datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
        return datasource;
    }
@ -107,6 +114,8 @@ public class DataSourceConfig {
        datasource.setTestWhileIdle(testWhileIdle);
        datasource.setTestOnBorrow(testOnBorrow);
        datasource.setTestOnReturn(testOnReturn);
        datasource.setPoolPreparedStatements(poolPreparedStatements);
        datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
        return datasource;
    }
@ -136,6 +145,8 @@ public class DataSourceConfig {
        datasource.setTestWhileIdle(testWhileIdle);
        datasource.setTestOnBorrow(testOnBorrow);
        datasource.setTestOnReturn(testOnReturn);
        datasource.setPoolPreparedStatements(poolPreparedStatements);
        datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
        return datasource;
    }

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

@ -164,7 +164,7 @@ public class QueryController {
            @ApiParam(name = "id", value = "指标id", required = true) @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "date", value = "时间(yyyy-MM-dd)", required = true) @RequestParam(value = "date", required = true) String date) {
        return  deleteData(DateUtil.strToDate(date, "yyyy-MM-dd"),id).toString();
        return deleteData(DateUtil.strToDate(date, "yyyy-MM-dd"), id).toString();
    }
    @ApiOperation(value = "删除某一天的数据")
@ -173,7 +173,7 @@ public class QueryController {
            @ApiParam(name = "date", value = "时间(yyyy-MM-dd)", required = true) @RequestParam(value = "date", required = true) String date) {
        return deleteData(DateUtil.strToDate(date, "yyyy-MM-dd"),null).toString();
        return deleteData(DateUtil.strToDate(date, "yyyy-MM-dd"), null).toString();
    }
    /**
@ -184,8 +184,10 @@ public class QueryController {
     */
    private net.sf.json.JSONObject deleteData(Date quotaDate, String quotaCode) {
        net.sf.json.JSONObject jsonObject = new net.sf.json.JSONObject();
        JestClient jestClient = null;
        try {
            JestClient jestClient = elasticFactory.getJestClient();
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -219,6 +221,10 @@ public class QueryController {
            jsonObject.put("flag", false);
            jsonObject.put("message", e.getMessage());
            return jsonObject;
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
    }
}

+ 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) {

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

@ -24,17 +24,28 @@ 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){
            try {
                keyList = initHealthLabesMap(jdbcTemplate, temp, one);
                for(String key:keyList){
                if("63".equals(temp.getQuotaCode())){
                    DataModel dataModelTemp = new DataModel();
                    BeanUtils.copyProperties(one, dataModelTemp);
                    DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(dataModelTemp, key);
                    DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(dataModelTemp, one.getHealthProblem());
                    returnList.add(dataModelTemp);
                }else{
                    keyList = initHealthLabesMap(jdbcTemplate, temp, one);
                    for(String key:keyList){
                        DataModel dataModelTemp = new DataModel();
                        BeanUtils.copyProperties(one, dataModelTemp);
                        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);

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

@ -13,6 +13,9 @@ import org.springframework.util.StringUtils;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.concurrent.TimeUnit;
/**
@ -23,11 +26,9 @@ public class ElasticFactory {
    private static JestClientFactory factory = null;
    @Value("${es.host}")
    private String esHost;
    @Value("${es.port}")
    private String port;
    @Value("${es.tPort}")
    private String tPort;
    private String esHost;//http://59.61.92.90:9065,http://59.61.92.90:9067
    @Value("${es.tHost}")
    private String tHost;// 59.61.92.90:9066,59.61.92.90:9068
    @Value("${es.clusterName}")
    private String clusterName;
//-----------------------------------jestClient----------------------------------------
@ -46,23 +47,28 @@ public class ElasticFactory {
    /**
     * 初始化链接
     * 9200
     */
    public synchronized void init() {
        String[] hostArray = esHost.split(",");
        // Construct a new Jest client according to configuration via factory
        factory = new JestClientFactory();
        factory.setHttpClientConfig(new HttpClientConfig
                .Builder("http://" + esHost + ":" + port)
        HttpClientConfig httpClientConfig = new HttpClientConfig
                .Builder(Arrays.asList(hostArray))//http://59.61.92.90:9065,http://59.61.92.90:9067
                .multiThreaded(true)
                .maxTotalConnection(50)// 最大链接
                .maxConnectionIdleTime(120, TimeUnit.SECONDS)//链接等待时间
                .connTimeout(60*1000)
               // .discoveryEnabled(true)
                .readTimeout(60*1000)//60秒
                .build());//得到链接
                .connTimeout(60 * 1000)
                // .discoveryEnabled(true)
                .readTimeout(60 * 1000)//60秒
                .build();
        factory.setHttpClientConfig(httpClientConfig);//得到链接
    }
    //-----------------------------------TransportClient----------------------------------------
    private Client transportClient;
    private TransportClient transportClient;
    public Client getTransportClient() {
        try {
@ -74,15 +80,25 @@ public class ElasticFactory {
        return null;
    }
    /**
     * 9300
     *
     * @throws UnknownHostException
     */
    private synchronized void initTranClient() throws UnknownHostException {
        if (transportClient == null) {
            String[] hosts = tHost.split(",");
            Settings settings = Settings.settingsBuilder()
                   // .put("client.transport.sniff", true)//开启嗅探功能
                    // .put("client.transport.sniff", true)//开启嗅探功能
                    .put("cluster.name", StringUtils.isEmpty(clusterName) ? "jkzl" : clusterName)//默认集群名字是jkzl
                    .build();
            transportClient = TransportClient.builder().settings(settings).build()
                    .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(esHost), Integer.valueOf(tPort)));
            transportClient = TransportClient.builder().settings(settings).build();
            for (String oneHost : hosts) {
                String[] hostAndport = oneHost.split(":");
                transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostAndport[0]), Integer.valueOf(hostAndport[1])));
            }
        }
    }
}

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

@ -36,9 +36,10 @@ public class ElastricSearchSave {
    private ElasticFactory elasticFactory;
    public Boolean save(List<SaveModel> sms) {
        JestClient jestClient = null;
        try {
            //得到链接
            JestClient jestClient = elasticFactory.getJestClient();
            jestClient = elasticFactory.getJestClient();
            int success = 0;
            int error = 0;
@ -55,21 +56,27 @@ public class ElastricSearchSave {
                }
            }
            BulkResult br = jestClient.execute(bulk.build());
            logger.info("save flag:" + br.isSucceeded());
            logger.info("save success:" + success);
            logger.info("save error:" + error);
            return br.isSucceeded();
        } catch (Exception e) {
            logger.error(" save error :" + e.getMessage());
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
        return null;
    }
    public Boolean update(List<SaveModel> sms) {
        JestClient jestClient = null;
        try {
            //得到链接
            JestClient jestClient = elasticFactory.getJestClient();
            jestClient = elasticFactory.getJestClient();
            int success = 0;
            int error = 0;
@ -77,8 +84,8 @@ public class ElastricSearchSave {
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (SaveModel obj : sms) {
                try {
                    JSONObject jo=new JSONObject();
                    jo.put("doc",obj);
                    JSONObject jo = new JSONObject();
                    jo.put("doc", obj);
                    Update index = new Update.Builder(jo.toString()).index(esIndex).type(esType).id(obj.getId()).build();
                    bulk.addAction(index);
                    success++;
@ -92,9 +99,14 @@ public class ElastricSearchSave {
            logger.info("update flag:" + br.isSucceeded());
            logger.info("update success:" + success);
            logger.info("update error:" + error);
            jestClient.shutdownClient();
            return isSuccessed;
        } catch (Exception e) {
            logger.error(" update error :" + e.getMessage());
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
        return null;
    }

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

@ -153,7 +153,7 @@ public class CurrentMysqlToEsQuotaJob implements Job {
                //3.统计数据
                List<SaveModel> sms = compute(filterModel.getData(), dimensionQuotas, timeLevel, one);
                //4.更新数据
                Boolean success = updateData(sms, quotaDate, one.getId(), timeLevel,dimensionQuotas.size());
                Boolean success = updateData(sms, quotaDate, one.getId(), timeLevel, dimensionQuotas.size());
                tjQuotaLog.setJobType(success ? "1" : "0");
                tjQuotaLog.setJobEndTime(new Date());
@ -171,14 +171,16 @@ public class CurrentMysqlToEsQuotaJob implements Job {
    /**
     * 删除 某个指标某一天的某个timelevel的数据
     *  @param quotaDate
     *
     * @param quotaDate
     * @param quotaCode
     * @param timeLevel
     * @param size
     */
    private boolean updateData(List<SaveModel> sms, Date quotaDate, String quotaCode, String timeLevel, int size) {
        JestClient jestClient = null;
        try {
            JestClient jestClient = elasticFactory.getJestClient();
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
@ -195,19 +197,19 @@ public class CurrentMysqlToEsQuotaJob implements Job {
            List<SaveModel> quarySaveModels = result.getSourceAsObjectList(SaveModel.class);
            //如果之前有值就用查询出来的然后修改数目即可
            if (quarySaveModels != null && quarySaveModels.size() > 0) {
                List<SaveModel> saveModels=new ArrayList<>();
                List<SaveModel> saveModels = new ArrayList<>();
                //把新的值赋值给ES查询出来的值
                Map<String,SaveModel> newSaveModelMaps=new HashMap<>();
                Map<String, SaveModel> newSaveModelMaps = new HashMap<>();
                //list转map
                for(SaveModel newSaveModel:sms){
                    StringBuffer key=new StringBuffer(newSaveModel.getTeam()+"-"+newSaveModel.getSlaveKey1()+"-"+newSaveModel.getSlaveKey2()+"-"+newSaveModel.getSlaveKey3()+"-"+newSaveModel.getSlaveKey4());
                    newSaveModelMaps.put(key.toString(),newSaveModel);
                for (SaveModel newSaveModel : sms) {
                    StringBuffer key = new StringBuffer(newSaveModel.getTeam() + "-" + newSaveModel.getSlaveKey1() + "-" + newSaveModel.getSlaveKey2() + "-" + newSaveModel.getSlaveKey3() + "-" + newSaveModel.getSlaveKey4());
                    newSaveModelMaps.put(key.toString(), newSaveModel);
                }
                for (SaveModel esSavemodel : quarySaveModels) {
                    StringBuffer key=new StringBuffer(esSavemodel.getTeam()+"-"+esSavemodel.getSlaveKey1()+"-"+esSavemodel.getSlaveKey2()+"-"+esSavemodel.getSlaveKey3()+"-"+esSavemodel.getSlaveKey4());
                    SaveModel newSaveMode=newSaveModelMaps.get(key.toString());
                    if(newSaveMode!=null){
                    StringBuffer key = new StringBuffer(esSavemodel.getTeam() + "-" + esSavemodel.getSlaveKey1() + "-" + esSavemodel.getSlaveKey2() + "-" + esSavemodel.getSlaveKey3() + "-" + esSavemodel.getSlaveKey4());
                    SaveModel newSaveMode = newSaveModelMaps.get(key.toString());
                    if (newSaveMode != null) {
                        esSavemodel.setResult1(newSaveMode.getResult1());
                        esSavemodel.setResult2(newSaveMode.getResult2());
                        esSavemodel.setCreateTime(new Date());
@ -220,6 +222,10 @@ public class CurrentMysqlToEsQuotaJob implements Job {
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
        return false;
    }

+ 8 - 3
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/job/business/MysqlToEsQuotaJob.java

@ -132,7 +132,7 @@ public class MysqlToEsQuotaJob implements Job {
        this.quotaDate = DateUtil.strToDate(endTime, "yyyy-MM-dd");
        this.wlyyJobCongId = map.getString("jobConfig");
        this.quartzJobConfig=quartzJobConfigDao.findById(wlyyJobCongId);
        this.quartzJobConfig = quartzJobConfigDao.findById(wlyyJobCongId);
    }
    /**
@ -180,8 +180,9 @@ public class MysqlToEsQuotaJob implements Job {
     * @param timeLevel
     */
    private void deleteData(Date quotaDate, String quotaCode, String timeLevel) {
        JestClient jestClient = null;
        try {
            JestClient jestClient = elasticFactory.getJestClient();
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
@ -208,6 +209,10 @@ public class MysqlToEsQuotaJob implements Job {
            logger.info("delete flag:" + br.isSucceeded());
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
    }
@ -284,7 +289,7 @@ public class MysqlToEsQuotaJob implements Job {
                dataModels = SpringUtil.getBean(ExtractHelper.class).extractData(quartzJobConfig, startTime, endTime, year, timeLevel);
            } else {
                //缓存的key 是 时间+timelevel+key
                StringBuffer bu = new StringBuffer(DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + "-" + timeLevel + "-" +quartzJobConfig.getCacheKey());
                StringBuffer bu = new StringBuffer(DateUtil.dateToStr(quotaDate, "yyyy-MM-dd") + "-" + timeLevel + "-" + quartzJobConfig.getCacheKey());
                //支持的话判断缓存有没有值
                dataModels = Cache.getCache(bu.toString());
                if (dataModels == null) {

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

@ -71,7 +71,7 @@ public class ExtractDataService {
    public void extractOneDateWithId(String date, String quotaId) {
        String sql = "select * from wlyy_quota_result w where w.level1_type=1  and w.quato_code !=18 and w.quato_code !=19 and quota_date='" + date + "' and quato_code='" + quotaId + "'";
        List<WlyyQuotaResult> quotaResults = jdbcTemplate.query(sql, new BeanPropertyRowMapper(WlyyQuotaResult.class));
        save2es(quotaResults, quotaId,date );
        save2es(quotaResults, quotaId, date);
        logger.info("date:" + date + ",quotaId:" + quotaId + "      success");
    }
@ -125,8 +125,9 @@ public class ExtractDataService {
    }
    private void deleteData(Date quotaDate, String quotaCode) {
        JestClient jestClient = null;
        try {
            JestClient jestClient = elasticFactory.getJestClient();
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
@ -150,12 +151,17 @@ public class ExtractDataService {
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
    }
    private void deleteData(Date quotaDate) {
        JestClient jestClient = null;
        try {
            JestClient jestClient = elasticFactory.getJestClient();
             jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
@ -178,6 +184,10 @@ public class ExtractDataService {
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
    }
@ -193,11 +203,11 @@ public class ExtractDataService {
            //
            quotaResults.stream().forEach(one -> {
                SaveModel saveModelTemp = new SaveModel();
                if("25".equals(one.getQuatoCode())){
                if ("25".equals(one.getQuatoCode())) {
                    //25的咨询到达量 存到3的到达量去
                    saveModelTemp.setQuotaCode("3");
                }else{
                saveModelTemp.setQuotaCode(one.getQuatoCode());
                } else {
                    saveModelTemp.setQuotaCode(one.getQuatoCode());
                }
                saveModelTemp.setQuotaDate(one.getQuotaDate());
                saveModelTemp.setCreateTime(one.getCreateTime());

+ 9 - 2
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,7 +306,7 @@ public class JobService {
        int day = daysBetween(startDate, endDate);
        for (int i = 0; i < day; i++) {
            Cache.cleanCache();//清空缓存
            Thread.sleep(60000L);//休息60秒
           // Thread.sleep(60000L);//休息60秒
            productDataByOneDay(getYesterday(i, startDate));
        }
    }
@ -337,6 +343,7 @@ public class JobService {
        }
        int day = daysBetween(startDate, endDate);
        for (int i = 0; i < day; i++) {
            Cache.cleanCache();//清空缓存
            productDataByOneDayWithId(getYesterday(i, startDate), id);
        }
    }

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

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

@ -23,7 +23,7 @@ public class DataModel {
    private String healthLable;//健康标签
    private Double num=1.0;//分数 如果是累加的计算 默认是1 如果是分数从数据库拿
    private String prescriptionCode;//处方code
    private String healthProblem;//诊断标签
    public String getHealthLable() {
        return healthLable;
@ -181,4 +181,12 @@ public class DataModel {
    public void setPrescriptionCode(String prescriptionCode) {
        this.prescriptionCode = prescriptionCode;
    }
    public String getHealthProblem() {
        return healthProblem;
    }
    public void setHealthProblem(String healthProblem) {
        this.healthProblem = healthProblem;
    }
}

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

@ -43,9 +43,8 @@ systemConfig:
es:
  index: wlyy_quota_dev
  type: wlyy_quota_dev
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

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

@ -48,9 +48,8 @@ systemConfig:
es:
  index: wlyy_quota_test
  type: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl
wlyy:

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

@ -30,9 +30,8 @@ systemConfig:
es:
  index: wlyy_quota_prod
  type: wlyy_quota_prod
  host:  59.61.92.90
  port: 9067
  tPort: 9068
  host:  http://59.61.92.90:9065,http://59.61.92.90:9067
  tHost: 59.61.92.90:9066,59.61.92.90:9068
  clusterName: jkzl
wlyy:

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

@ -48,9 +48,8 @@ systemConfig:
es:
  index: wlyy_quota_test
  type: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl
wlyy:

+ 5 - 4
patient-co/patient-co-statistics-es/src/main/resources/application.yml

@ -14,17 +14,18 @@ spring:
  datasource:
    driverClassName: com.mysql.jdbc.Driver
    initialSize: 20
    initialSize: 50
    maxActive: 50
    minIdle: 50 #最大空闲连接
    maxWait: 10
    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.
@ -64,4 +65,4 @@ hibernate:
    naming_strategy: org.hibernate.cfg.ImprovedNamingStrategy
JobService:
  sleepTime: 30000
  sleepTime: 40000

+ 2 - 2
patient-co/patient-co-statistics/src/main/java/com/yihu/wlyy/statistics/model/job/QuartzJobLog.java

@ -75,13 +75,13 @@ public class QuartzJobLog implements java.io.Serializable {
		this.jobId = jobId;
	}
	@Column(name = "job_content", length = 1000)
	@Column(name = "job_content")
	public String getJobContent() {
		return this.jobContent;
	}
	public void setJobContent(String jobContent) {
		this.jobContent = "";
		this.jobContent = jobContent;
	}
	@Column(name = "job_type", length = 1)

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

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

+ 41 - 29
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/es/ElasticFactory.java

@ -14,61 +14,62 @@ import org.springframework.util.StringUtils;
import javax.annotation.PostConstruct;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
/**
 * Created by chenweida on 2017/6/5.
 */
@Component
public class ElasticFactory {
	private static JestClientFactory factory = null;
	
	@Value("${es.host}")
	private String esHost;
	@Value("${es.port}")
	private String port;
	@Value("${es.tPort}")
	private String tPort;
	private String esHost;//http://59.61.92.90:9065,http://59.61.92.90:9067
	@Value("${es.tHost}")
	private String tHost;// 59.61.92.90:9066,59.61.92.90:9068
	@Value("${es.clusterName}")
	private String clusterName;
//-----------------------------------jestClient----------------------------------------
	
	/**
	 * @param "http://localhost:9200"
	 * @return
	 */
	//@PostConstruct
	public JestClient getJestClient() {
		synchronized (ElasticFactory.class) {
			if (factory == null) {
				//初始化链接
				init();
			}
		if (factory == null) {
			//初始化链接
			init();
		}
		return factory.getObject();
	}
	
	/**
	 * 初始化链接
	 * 9200
	 */
	public synchronized void init() {
		
		String[] hostArray = esHost.split(",");
		// Construct a new Jest client according to configuration via factory
		factory = new JestClientFactory();
		factory.setHttpClientConfig(new HttpClientConfig
				.Builder("http://" + esHost + ":" + port)
		HttpClientConfig httpClientConfig = new HttpClientConfig
				.Builder(Arrays.asList(hostArray))
				.multiThreaded(true)
				.maxTotalConnection(50)// 最大链接
				.maxConnectionIdleTime(120, TimeUnit.SECONDS)//链接等待时间
				.connTimeout(30000)
				.discoveryEnabled(true)
				.readTimeout(30000)//30秒
				.build());//得到链接
				.connTimeout(60 * 1000)
				// .discoveryEnabled(true)
				.readTimeout(60 * 1000)//60秒
				.build();
		factory.setHttpClientConfig(httpClientConfig);//得到链接
	}
	
	//-----------------------------------TransportClient----------------------------------------
	private Client transportClient;
	
	private TransportClient transportClient;
	public Client getTransportClient() {
		try {
			initTranClient();
@ -78,16 +79,27 @@ public class ElasticFactory {
		}
		return null;
	}
	
	/**
	 * 9300
	 *
	 * @throws UnknownHostException
	 */
	private synchronized void initTranClient() throws UnknownHostException {
		if (transportClient == null) {
			String[] hosts = tHost.split(",");
			Settings settings = Settings.settingsBuilder()
					.put("client.transport.sniff", true)//开启嗅探功能
					// .put("client.transport.sniff", true)//开启嗅探功能
					.put("cluster.name", StringUtils.isEmpty(clusterName) ? "jkzl" : clusterName)//默认集群名字是jkzl
					.build();
			
			transportClient = TransportClient.builder().settings(settings).build()
					.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(esHost), Integer.valueOf(tPort)));
			transportClient = TransportClient.builder().settings(settings).build();
			for (String oneHost : hosts) {
				String[] hostAndport = oneHost.split(":");
				transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostAndport[0]), Integer.valueOf(hostAndport[1])));
			}
		}
	}
}

+ 31 - 26
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/config/es/ElastricSearchSave.java

@ -20,30 +20,35 @@ import java.util.List;
@Component
@Scope("prototype")
public class ElastricSearchSave {
	
	private Logger logger = LoggerFactory.getLogger(ElastricSearchSave.class);
	@Autowired
	private ElasticFactory elasticFactory;
	
	public Boolean save(List  sms,String esIndex,String esType) {
		try {
			//得到链接
			JestClient jestClient = elasticFactory.getJestClient();
			
			Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
			for (Object obj : sms) {
				Index index = new Index.Builder(obj).build();
				bulk.addAction(index);
			}
			BulkResult br = jestClient.execute(bulk.build());
			logger.info("save data count:" + sms.size());
			logger.info("save flag:" + br.isSucceeded());
			return br.isSucceeded();
		} catch (Exception e) {
			e.printStackTrace();
			logger.error(" save error :" + e.getMessage());
		}
		return null;
	}
	
    private Logger logger = LoggerFactory.getLogger(ElastricSearchSave.class);
    @Autowired
    private ElasticFactory elasticFactory;
    public Boolean save(List sms, String esIndex, String esType) {
        JestClient jestClient = null;
        try {
            //得到链接
            jestClient = elasticFactory.getJestClient();
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (Object obj : sms) {
                Index index = new Index.Builder(obj).build();
                bulk.addAction(index);
            }
            BulkResult br = jestClient.execute(bulk.build());
            logger.info("save data count:" + sms.size());
            logger.info("save flag:" + br.isSucceeded());
            return br.isSucceeded();
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(" save error :" + e.getMessage());
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
        return null;
    }
}

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

@ -1161,7 +1161,8 @@ public class JwPrescriptionService {
        SearchResult result = jestClient.execute(search);
        
        List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
        
        jestClient.shutdownClient();
        return followupContentESDOList;
    }
    
@ -1185,6 +1186,7 @@ public class JwPrescriptionService {
        this.esDeleteFollowUpContent(dataList);
        //保存新的随访详情记录
        elastricSearchSave.save(newdatalist,esIndex,esType);
        jestClient.shutdownClient();
    }
    
    public HashMap<String,String> operaESFollowUpContentData(List<FollowupContentESDO> esdataList){

+ 2 - 3
patient-co/patient-co-wlyy-job/src/main/resources/application-dev.yml

@ -123,7 +123,6 @@ es:
    HealthEduArticlePatient: health_edu_article_patient_dev
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

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

@ -115,7 +115,6 @@ es:
    HealthEduArticlePatient: wlyy_quota_test
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

+ 2 - 3
patient-co/patient-co-wlyy-job/src/main/resources/application-prod.yml

@ -123,7 +123,6 @@ es:
    HealthEduArticlePatient: health_edu_article_patient_prod
    Statistics: wlyy_quota_prod
    FollowUpContent: wlyy_followup_content
  host: 59.61.92.90
  port: 9065
  tPort: 9066
  host:  http://59.61.92.90:9065,http://59.61.92.90:9067
  tHost: 59.61.92.90:9066,59.61.92.90:9068
  clusterName: jkzl

+ 2 - 3
patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml

@ -120,7 +120,6 @@ es:
    HealthEduArticlePatient: health_edu_article_patient_test
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

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

+ 34 - 22
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/es/ElasticFactory.java

@ -14,21 +14,21 @@ import org.springframework.util.StringUtils;
import javax.annotation.PostConstruct;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
/**
 * Created by chenweida on 2017/6/5.
 */
@Component
public class ElasticFactory {
    private static JestClientFactory factory = null;
    @Value("${es.host}")
    private String esHost;
    @Value("${es.port}")
    private String port;
    @Value("${es.tPort}")
    private String tPort;
    private String esHost;//http://59.61.92.90:9065,http://59.61.92.90:9067
    @Value("${es.tHost}")
    private String tHost;// 59.61.92.90:9066,59.61.92.90:9068
    @Value("${es.clusterName}")
    private String clusterName;
//-----------------------------------jestClient----------------------------------------
@ -37,37 +37,38 @@ public class ElasticFactory {
     * @param "http://localhost:9200"
     * @return
     */
    //@PostConstruct
    public JestClient getJestClient() {
        synchronized (ElasticFactory.class) {
            if (factory == null) {
                //初始化链接
                init();
            }
        if (factory == null) {
            //初始化链接
            init();
        }
        return factory.getObject();
    }
    /**
     * 初始化链接
     * 9200
     */
    public synchronized void init() {
        String[] hostArray = esHost.split(",");
        // Construct a new Jest client according to configuration via factory
        factory = new JestClientFactory();
        factory.setHttpClientConfig(new HttpClientConfig
                .Builder("http://" + esHost + ":" + port)
        HttpClientConfig httpClientConfig = new HttpClientConfig
                .Builder(Arrays.asList(hostArray))
                .multiThreaded(true)
                .maxTotalConnection(50)// 最大链接
                .maxConnectionIdleTime(120, TimeUnit.SECONDS)//链接等待时间
                .connTimeout(30000)
                .discoveryEnabled(true)
                .readTimeout(30000)//30秒
                .build());//得到链接
                .connTimeout(60 * 1000)
                // .discoveryEnabled(true)
                .readTimeout(60 * 1000)//60秒
                .build();
        factory.setHttpClientConfig(httpClientConfig);//得到链接
    }
    //-----------------------------------TransportClient----------------------------------------
    private Client transportClient;
    private TransportClient transportClient;
    public Client getTransportClient() {
        try {
@ -79,15 +80,26 @@ public class ElasticFactory {
        return null;
    }
    /**
     * 9300
     *
     * @throws UnknownHostException
     */
    private synchronized void initTranClient() throws UnknownHostException {
        if (transportClient == null) {
            String[] hosts = tHost.split(",");
            Settings settings = Settings.settingsBuilder()
                    .put("client.transport.sniff", true)//开启嗅探功能
                    // .put("client.transport.sniff", true)//开启嗅探功能
                    .put("cluster.name", StringUtils.isEmpty(clusterName) ? "jkzl" : clusterName)//默认集群名字是jkzl
                    .build();
            transportClient = TransportClient.builder().settings(settings).build()
                    .addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(esHost), Integer.valueOf(tPort)));
            transportClient = TransportClient.builder().settings(settings).build();
            for (String oneHost : hosts) {
                String[] hostAndport = oneHost.split(":");
                transportClient.addTransportAddress(new InetSocketTransportAddress(InetAddress.getByName(hostAndport[0]), Integer.valueOf(hostAndport[1])));
            }
        }
    }
}

+ 8 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/es/ElastricSearchSave.java

@ -27,10 +27,12 @@ public class ElastricSearchSave {
    @Autowired
    private ElasticFactory elasticFactory;
    public Boolean save(List  sms,String esIndex,String esType) {
    public Boolean save(List sms, String esIndex, String esType) {
        JestClient jestClient = null;
        try {
            //得到链接
            JestClient jestClient = elasticFactory.getJestClient();
            jestClient = elasticFactory.getJestClient();
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (Object obj : sms) {
@ -44,6 +46,10 @@ public class ElastricSearchSave {
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(" save error :" + e.getMessage());
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
        return null;
    }

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

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

+ 19 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/application/ApplicationDao.java

@ -0,0 +1,19 @@
package com.yihu.wlyy.repository.application;
import com.yihu.wlyy.entity.address.Country;
import com.yihu.wlyy.entity.application.Application;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by yeshijie on 2017/11/13.
 */
public interface ApplicationDao extends PagingAndSortingRepository<Application, Long>, JpaSpecificationExecutor<Application> {
    @Query("from Application a where a.type=?1 and a.del= '1' and (a.hospitals is null or a.hospitals = '' or a.hospitals = ?2)")
    List<Application> findByTypeAndHopital(String type,String hospital);
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/SignPatientLabelDao.java

@ -33,7 +33,7 @@ public interface SignPatientLabelDao extends
     * @param status
     * @return
     */
    @Query("select a from SignPatientLabel a where a.labelType = ?1 and a.status = ?2 ORDER BY a.sort ASC ")
    @Query("select a from SignPatientLabel a where a.labelType = ?1 and a.status = ?2 and a.labelCode !=0 ORDER BY a.sort ASC ")
    List<SignPatientLabel> findByLabelTypeAndStatus(String labelType,Integer status);
    /**

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

+ 49 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/application/ApplicationService.java

@ -0,0 +1,49 @@
package com.yihu.wlyy.service.app.application;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.application.Application;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.repository.application.ApplicationDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * Created by yeshijie on 2017/11/13.
 */
@Service
public class ApplicationService extends BaseService{
    @Autowired
    private ApplicationDao applicationDao;
    @Autowired
    private DoctorDao doctorDao;
    /**
     * 获取应用
     * @param type
     * @param doctor
     * @return
     */
    public JSONArray getAppList(String type,String doctor){
        JSONArray re = new JSONArray();
        Doctor d = doctorDao.findByCode(doctor);
        List<Application> appList = applicationDao.findByTypeAndHopital(type,d.getHospital());
        appList.forEach(application -> {
            JSONObject json = new JSONObject();
            json.put("name",application.getName());
            json.put("code",application.getCode());
            json.put("icon",application.getIcon());
            json.put("type",application.getType());
            json.put("url",application.getUrl());
            re.add(json);
        });
        return re;
    }
}

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

@ -2657,9 +2657,10 @@ public class ConsultTeamService extends ConsultService {
        contentobj.put("doctorremind","已向居民发送问卷填写请求,填写完成后您将收到消息提醒");
        contentobj.put("patientremind","填写完成并提交后,医生将可以查看您的问卷内容");
        contentobj.put("msgType",type);
        contentobj.put("isSendWxTemplate",true);//是否发送咨询回复的微信模板
        //医生发送Im消息
        ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "17", contentobj.toString(), null);
    
        contentobj.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
        //居民发送Im消息
        ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "17", contentobj.toString(), null);
    }

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/ehc/PatientEHCService.java

@ -44,7 +44,7 @@ public class PatientEHCService extends BaseService {
    public String EHCRedirecturl(String getUid) throws Exception {
        String result = null;
        try {
            String format = "yyyyMMddHHmmss";
            String format = "yyyyMMdd";
            String currentTime = DateUtils.getOutTradeTime();
            String uuid = DateUtil.getUidNo(4);
@ -101,6 +101,7 @@ public class PatientEHCService extends BaseService {
            bizContent.put("telephone", phone);
            bizContent.put("address", address);
            bizContent.put("work_unit", provinceName + cityName + townName + streetName);
            logger.info("params======> "+bizContent.toString());
            result = httpUtils(getUid, api, appId, termId, appKey, signType, encType, version, redirecturl, bizContent);
        } catch (Exception e) {

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

@ -870,7 +870,7 @@ public class FollowUpService extends BaseService {
                    Doctor doctor1 = doctorDao.findByCode(doctor);
                    String doctorOpenID = doctor1.getOpenid();
                    if (StringUtils.isNotEmpty(doctorOpenID)) {
                        String url = doctorAssistant + "/doctor/feldsher/sendDoctorTemplates";
                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                        List<NameValuePair> params = new ArrayList<>();
                        params.add(new BasicNameValuePair("type", "6"));
                        params.add(new BasicNameValuePair("openId", doctorOpenID));
@ -903,50 +903,59 @@ public class FollowUpService extends BaseService {
     */
    @Transactional
    public void esSaveFollowupProjectData(String id, String followupProject, String followupProjectData) throws Exception {
        JestClient jestClient = null;
        try {
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
                        .must(QueryBuilders.matchQuery("followup_project", followupProject))
        );
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
        List<FollowupContentESDO> dataList = result.getSourceAsObjectList(FollowupContentESDO.class);
        //删除原有记录
        this.esDeleteFollowUpContent(dataList);
        //保存新的随访详情信息
        List<FollowupContentESDO> newdatalist = new ArrayList<>();
        FollowupContentESDO followupContentESDO = new FollowupContentESDO();
        followupContentESDO = JSON.parseObject(followupProjectData, FollowupContentESDO.class);
        followupContentESDO.setFollowup_id(id);
        followupContentESDO.setFollowup_project(followupProject);
        followupContentESDO.setCreate_time(new Date());
        newdatalist.add(followupContentESDO);
        elastricSearchSave.save(newdatalist, esIndex, esType);
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
                    new BoolQueryBuilder()
                            .must(QueryBuilders.matchQuery("followup_id", id))
                            .must(QueryBuilders.matchQuery("followup_project", followupProject))
            );
            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                    .build();
            SearchResult result = jestClient.execute(search);
            List<FollowupContentESDO> dataList = result.getSourceAsObjectList(FollowupContentESDO.class);
            //删除原有记录
            this.esDeleteFollowUpContent(dataList);
            //保存新的随访详情信息
            List<FollowupContentESDO> newdatalist = new ArrayList<>();
            FollowupContentESDO followupContentESDO = new FollowupContentESDO();
            followupContentESDO = JSON.parseObject(followupProjectData, FollowupContentESDO.class);
            followupContentESDO.setFollowup_id(id);
            followupContentESDO.setFollowup_project(followupProject);
            followupContentESDO.setCreate_time(new Date());
            newdatalist.add(followupContentESDO);
            elastricSearchSave.save(newdatalist, esIndex, esType);
            //如果该随访是已完成的,则添加随访信息上传映射,上传到基卫
            Followup followup = followupDao.findOne(Long.valueOf(id));
            if ("1".equals(followup.getStatus())) {
                FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(id));
                if (followupMapping == null) {
                    followupMapping = new FollowupMapping();
                    followupMapping.setCode(UUID.randomUUID().toString());
                    followupMapping.setFollowupId(Integer.parseInt(id));
                    followupMapping.setUpdateTime(DateUtil.getNowTimestamp());
                    followupMapping.setCreateTime(DateUtil.getNowTimestamp());
                }
                followupMapping.setNeedUpload(1);
                followUpMappingDao.save(followupMapping);
            }
        //如果该随访是已完成的,则添加随访信息上传映射,上传到基卫
        Followup followup = followupDao.findOne(Long.valueOf(id));
        if ("1".equals(followup.getStatus())) {
            FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(id));
            if (followupMapping == null) {
                followupMapping = new FollowupMapping();
                followupMapping.setCode(UUID.randomUUID().toString());
                followupMapping.setFollowupId(Integer.parseInt(id));
                followupMapping.setUpdateTime(DateUtil.getNowTimestamp());
                followupMapping.setCreateTime(DateUtil.getNowTimestamp());
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
            followupMapping.setNeedUpload(1);
            followUpMappingDao.save(followupMapping);
        }
    }
@ -954,21 +963,28 @@ public class FollowUpService extends BaseService {
     * ES获取面访项目数据
     */
    public FollowupContentESDO esGetFollowupProjectData(String id, String followupProject) throws Exception {
        //根据随访ID、分类ID获取随访记录详情
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
                        .must(QueryBuilders.matchQuery("followup_project", followupProject))
        );
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
        FollowupContentESDO followupContentESDO = result.getSourceAsObject(FollowupContentESDO.class);
        JestClient jestClient = null;
        FollowupContentESDO followupContentESDO = null;
        try {
            //根据随访ID、分类ID获取随访记录详情
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
                    new BoolQueryBuilder()
                            .must(QueryBuilders.matchQuery("followup_id", id))
                            .must(QueryBuilders.matchQuery("followup_project", followupProject))
            );
            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                    .build();
            SearchResult result = jestClient.execute(search);
            followupContentESDO = result.getSourceAsObject(FollowupContentESDO.class);
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
        return followupContentESDO;
    }
@ -979,8 +995,9 @@ public class FollowUpService extends BaseService {
     * @date 2017/11/1 15:17
     */
    public void esDeleteFollowUpContent(List<FollowupContentESDO> datalist) throws Exception {
        JestClient jestClient = null;
        try {
            JestClient jestClient = elasticFactory.getJestClient();
            jestClient = elasticFactory.getJestClient();
            //根据id批量删除
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (FollowupContentESDO obj : datalist) {
@ -991,8 +1008,11 @@ public class FollowUpService extends BaseService {
            logger.info("delete data count:" + datalist.size());
            logger.info("delete flag:" + br.isSucceeded());
        } catch (Exception e) {
            e.printStackTrace();
            jestClient.shutdownClient();
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
    }
@ -1004,31 +1024,37 @@ public class FollowUpService extends BaseService {
     * @date 2017/11/1 19:41
     */
    public List<String> esfindProjectByFollowupId(String id) throws Exception {
        //根据随访ID、分类ID获取随访记录详情
        JestClient jestClient = null;
        List<String> resultList = new ArrayList<>();
        try {
            //根据随访ID、分类ID获取随访记录详情
            elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
                    new BoolQueryBuilder()
                            .must(QueryBuilders.matchQuery("followup_id", id))
            );
            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                    .build();
            SearchResult result = jestClient.execute(search);
            List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
            followupContentESDOList = result.getSourceAsObjectList(FollowupContentESDO.class);
            if (!followupContentESDOList.isEmpty()) {
                for (FollowupContentESDO followupContentESDO : followupContentESDOList) {
                    resultList.add(followupContentESDO.getFollowup_project());
                }
            }
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
        );
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
        List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
        followupContentESDOList = result.getSourceAsObjectList(FollowupContentESDO.class);
        if (!followupContentESDOList.isEmpty()) {
            for (FollowupContentESDO followupContentESDO : followupContentESDOList) {
                resultList.add(followupContentESDO.getFollowup_project());
            jestClient.shutdownClient();
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
        return resultList;
    }
@ -1039,29 +1065,36 @@ public class FollowUpService extends BaseService {
     * @date 2017/11/1 19:41
     */
    public List<FollowupContentESDO> esfindFollowUpContestsByFollowupId(String id) throws Exception {
        //根据随访ID、分类ID获取随访记录详情
        List<String> resultList = new ArrayList<>();
        JestClient jestClient = null;
        List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
        try {
            //根据随访ID、分类ID获取随访记录详情
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
        searchSourceBuilder.query(
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
        );
            List<String> resultList = new ArrayList<>();
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
            jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            searchSourceBuilder.query(
                    new BoolQueryBuilder()
                            .must(QueryBuilders.matchQuery("followup_id", id))
            );
        List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                    .build();
            SearchResult result = jestClient.execute(search);
        } finally {
            if (jestClient != null) {
                jestClient.shutdownClient();
            }
        }
        return followupContentESDOList;
    }
    /**
     * 根据续方CODE获取随访记录信息
     *
     * @param prescriptionCode
     * @return
     */
@ -1076,6 +1109,7 @@ public class FollowUpService extends BaseService {
    /**
     * 获取随访详情记录分类记录数
     *
     * @param followupid
     * @param type
     * @return
@ -1084,25 +1118,25 @@ public class FollowUpService extends BaseService {
        int count = 0;
        String[] typelist = null;
        if(type.contains(",")){
        if (type.contains(",")) {
            typelist = type.split(",");
        }else{
        } else {
            typelist = new String[]{type};
        }
        for (String typekey: typelist) {
            if(!"drug".equals(type)){
        for (String typekey : typelist) {
            if (!"drug".equals(type)) {
                FollowupContentESDO followupContentESDO = this.esGetFollowupProjectData(followupid,typekey);
                if(followupContentESDO != null){
                    count ++;
                FollowupContentESDO followupContentESDO = this.esGetFollowupProjectData(followupid, typekey);
                if (followupContentESDO != null) {
                    count++;
                }
            }else{
            } else {
                //获取用药记录
                List<FollowupDrugs> drugsList = followupDrugsDao.findByFollowupId(Long.valueOf(followupid));
                if(!drugsList.isEmpty()){
                    count = count +drugsList.size();
                if (!drugsList.isEmpty()) {
                    count = count + drugsList.size();
                }
            }
        }

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

@ -487,7 +487,7 @@ public class PatientHealthIndexService extends BaseService {
            //            新增发送医生助手模板消息 v1.4.0 by wujunjie
            if (StringUtils.isNotEmpty(doctorOpenID)) {
                List<Message> messagesList = messageDao.findUnreadHealthIndex(patientCode, receiver);
                String url = doctorAssistant + "/doctor/feldsher/sendDoctorTemplates";
                String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("type", "3"));
                params.add(new BasicNameValuePair("openId", doctorOpenID));
@ -910,39 +910,28 @@ public class PatientHealthIndexService extends BaseService {
    private void sendPrescriptionHealthIndexMsgresult(DevicePatientHealthIndex result, Patient patient) {
        
        List<ConsultTeam> consultTeams = consultTeamDao.findUnfinishedConsultPrescription(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", "【本消息为系统提醒】:");
    
        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("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                    contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
                    contentPatient.put("needUpload","false");
                    contentPatient.put("type",1);
                    //患者发送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", "【本消息为系统提醒】:");
                    contentPatient.put("tzMsg", "体征记录:血压 "+result.getValue1()+"/"+result.getValue2()+" mmHg");
                    contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStrLong(result.getRecordDate()));
                    contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
                    contentPatient.put("needUpload","false");
                    contentPatient.put("type",2);
                    //患者发送Im消息
                    ImUtill.sendTopicIM(patient.getCode(), patient.getName(), consultTeam.getConsult(), "16", contentPatient.toString(), null);
                }
                }else if(2 == result.getType()){
                    contentPatient.put("tzMsg", "体征记录:血压 "+result.getValue1()+"/"+result.getValue2()+" mmHg");
                    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);
            }
        }
        
    }
    /**

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

@ -363,6 +363,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				//医生发送的消息
				contentDoctor.put("text", "请提供您最近一次的血糖检测数值及检测时间");
				contentDoctor.put("needUpload","false");
				contentDoctor.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentDoctor.put("type",2);
				
				//医生发送Im消息
@ -373,6 +374,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("tzMsg", "体征记录:血糖 "+imBloodSugarValue+"mmol/L");
				contentPatient.put("tzTime", "检测时间:"+DateUtil.dateToStr(imBloodSugarDate,"yyyy-MM-dd HH:mm:ss"));
				contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("needUpload","false");
				contentPatient.put("type",2);
				
@ -385,6 +387,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				//医生发送的消息
				contentDoctor.put("text", "请提供您最近一次的血糖检测数值及检测时间");
				contentDoctor.put("needUpload","true");
				contentDoctor.put("isSendWxTemplate",true);//是否发送咨询回复的微信模板
				contentDoctor.put("type",2);
				//医生发送Im消息
				ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "16", contentDoctor.toString(), null);
@ -395,6 +398,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("tzTime", "检测时间:");
				contentPatient.put("tzAlert","温馨提示:居民近30天未上传血糖体征数据,已通知居民上传数据,请耐心等待");
				contentPatient.put("needUpload","true");
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("type",2);
				
				//患者发送Im消息
@ -457,6 +461,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				//医生发送的消息
				contentDoctor.put("text", "请提供您最近一次的血压检测数值及检测时间");
				contentDoctor.put("needUpload","false");
				contentDoctor.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentDoctor.put("type",1);
				
				//医生发送Im消息
@ -468,6 +473,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("tzTime", "检测时间:"+jsonObject.getString("date"));
				contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
				contentPatient.put("needUpload","false");
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("type",1);
				
				//患者发送Im消息
@ -480,6 +486,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				//医生发送的消息
				contentDoctor.put("text", "请提供您最近一次的血压检测数值及检测时间");
				contentDoctor.put("needUpload","true");
				contentDoctor.put("isSendWxTemplate",true);//是否发送咨询回复的微信模板
				contentDoctor.put("type",1);
				//医生发送Im消息
				ImUtill.sendTopicIM(prescription.getDoctor(), prescription.getDoctorName(), prescription.getConsult(), "16", contentDoctor.toString(), null);
@ -490,6 +497,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("tzTime", "检测时间:");
				contentPatient.put("tzAlert","温馨提示:居民近30天未上传血压体征数据,已通知居民上传数据,请耐心等待");
				contentPatient.put("needUpload","true");
				contentPatient.put("isSendWxTemplate",false);//是否发送咨询回复的微信模板
				contentPatient.put("type",1);
				
				//患者发送Im消息

+ 6 - 6
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());
@ -1626,7 +1626,7 @@ public class PrescriptionInfoService extends BaseService {
    }
    public JSONArray getIcd10Info(String nameKey) {
        StringBuffer stringBuffer = new StringBuffer(" SELECT t.code,t.name FROM icd10_dict t WHERE t.name LIKE ?");
        StringBuffer stringBuffer = new StringBuffer(" SELECT t.code,t.name FROM icd10_dict t WHERE t.name LIKE ? and t.chronic_flag='1' ");
        List<Map<String, Object>> rs = jdbcTemplate.queryForList(stringBuffer.toString(), new Object[]{"%" + nameKey + "%"});
        return new JSONArray(rs);
    }

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

@ -577,7 +577,7 @@ public class FamilyContractService extends BaseService {
            }
//            新增发送医生助手模板消息 v1.4.0 by wujunjie
            if (StringUtils.isNotEmpty(d.getOpenid())){
                String url = doctorAssistant + "/doctor/feldsher/sendDoctorTemplates";
                String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("type", "5"));
                params.add(new BasicNameValuePair("openId", d.getOpenid()));
@ -698,7 +698,7 @@ public class FamilyContractService extends BaseService {
            //            新增发送医生助手模板消息 v1.4.0 by wujunjie
            if (StringUtils.isNotEmpty(d.getOpenid())){
                String url = doctorAssistant + "/doctor/feldsher/sendDoctorTemplates";
                String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("type", "5"));
                params.add(new BasicNameValuePair("openId", d.getOpenid()));
@ -3449,7 +3449,7 @@ public class FamilyContractService extends BaseService {
            }
            //            新增发送医生助手模板消息 v1.4.0 by wujunjie
            if (StringUtils.isNotEmpty(d.getOpenid())){
                String url = doctorAssistant + "/doctor/feldsher/sendDoctorTemplates";
                String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("type", "5"));
                params.add(new BasicNameValuePair("openId", d.getOpenid()));
@ -3661,7 +3661,7 @@ public class FamilyContractService extends BaseService {
            }
            //            新增发送医生助手模板消息 v1.4.0 by wujunjie
            if (StringUtils.isNotEmpty(d.getOpenid())){
                String url = doctorAssistant + "/doctor/feldsher/sendDoctorTemplates";
                String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("type", "5"));
                params.add(new BasicNameValuePair("openId", d.getOpenid()));

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

@ -434,7 +434,7 @@ public class StatisticsESService {
//        if (endDate.compareTo(dateFormat.format(new Date())) >= 0) {
//            endDate = elasticsearchUtil.getQuotaTime();
//        }
        List<SaveModel> list = elasticsearchUtil.findOneDateQuotaLevel1(endDate,endDate, area, level, index, "2");
        List<SaveModel> list = elasticsearchUtil.findOneDateQuotaLevel1(endDate, area, level, index, "2");
        List<Map<String, Object>> resultList = new ArrayList<>();
        DecimalFormat df = new DecimalFormat("0.0000");
        long total = 0;
@ -453,10 +453,10 @@ public class StatisticsESService {
                String code = saveModel.getSlaveKey1();
                if (!"2".equals(code)) {
                    total += saveModel.getResult2().intValue();
                    total += saveModel.getResult2();
                }
            } else {
                total += saveModel.getResult2().intValue();
                total += saveModel.getResult2();
            }
            resultList.add(map);
        }
@ -498,6 +498,50 @@ public class StatisticsESService {
        return new JSONArray(resultList);
    }
    /**
     * 缴费和未交费的人数
     * @param endDate
     * @param area
     * @param level
     * @return
     * @throws Exception
     */
    public JSONArray getPayPremiums(String endDate, String area, int level)throws Exception{
        //已缴费
        SaveModel paidSaveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate,endDate,area,level,"1","2");
        //未交费
        SaveModel noPaySaveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate,endDate,area,level,"14","2");
        List<Map<String, Object>> resultList = new ArrayList<>();
        DecimalFormat df = new DecimalFormat("0.0000");
        long paidTotal = paidSaveModel.getResult2().longValue();
        Map<String,Object> map1 = new HashedMap();
        long noPayTotal = noPaySaveModel.getResult2().longValue();
        Map<String,Object> map2 = new HashedMap();
        //求签约总数
        long totalNum = paidTotal+noPayTotal;
        map1.put("code","1");
        map1.put("amount",paidTotal);
        map1.put("name","已缴费人数");
        double rateG = (paidTotal > 0 ? paidTotal * 1.0000 / totalNum * 100 : 0);
        map1.put("rate", df.format(rateG));;
        map1.put("rateString", paidTotal + "/" + totalNum);
        resultList.add(map1);
        map2.put("code","0");
        map2.put("amount",noPayTotal);
        map2.put("name","未缴费人数");
        double rateG2 = (noPayTotal > 0 ? noPayTotal * 1.0000 / totalNum * 100 : 0);
        map2.put("rate", df.format(rateG2));;
        map2.put("rateString", noPayTotal + "/" + totalNum);
        resultList.add(map2);
        return new JSONArray(resultList);
    }
    public PopulationBase getPopulationBase(String code, String year) {
        String sql = "select * from wlyy_people_num where code=? and year=? ";
@ -520,8 +564,8 @@ public class StatisticsESService {
     */
    public long getIndexTotal(String endDate, String area, int level, String index, String timeLevel) throws Exception {
        //endDate = elasticsearchUtil.changeTime(endDate);
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate,endDate, area, level, index, timeLevel);
        endDate = elasticsearchUtil.changeTime(endDate);
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(endDate, area, level, index, timeLevel);
        return saveModel.getResult2().longValue();
    }
@ -543,10 +587,10 @@ public class StatisticsESService {
    public JSONObject getRenewPercent(String level, String area, String year) throws Exception {
        String renewIndex = "";
        if ("5".equals(level)) {
        if ("1".equals(level)) {
            //团队的续签量
            renewIndex = "42";
        } else if ("4".equals(level)) {
        } else if ("2".equals(level)) {
            //社区的续签量
            renewIndex = "43";
        } else if ("3".equals(level)) {
@ -641,7 +685,7 @@ public class StatisticsESService {
     * @return
     */
    public JSONObject getGroupInfo(String endDate, String lowCode, String area, int level, String year) throws Exception {
        List<SaveModel> list = elasticsearchUtil.findDateQuotaLevel1(endDate, endDate, area, level, "17", "2", lowCode, null, null);
        List<SaveModel> list = elasticsearchUtil.findDateQuotaLevel1(endDate, endDate, area, level, "17", "2", 1,lowCode, null, null);
        long total = 0;
        if (list.size() > 0) {
            total = list.get(0).getResult2().longValue();
@ -799,7 +843,7 @@ public class StatisticsESService {
        List<SaveModel> list = null;
        if (StringUtils.isNotEmpty(lowCode)) {
            //一级维度
            list = elasticsearchUtil.findLineChartDateQuotaLevel1(startDate, endDate, area, level, index, "2", lowCode, interval + "");
            list = elasticsearchUtil.findLineChartDateQuotaLevel1(startDate, endDate, area, level, index, "2", interval + "", lowCode);
        } else {
            list = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, area, level, index, "2", interval + "");
        }
@ -1711,22 +1755,21 @@ public class StatisticsESService {
            if (Constant.getNowYear().equals(year)) {
                timeKey = elasticsearchUtil.getQuotaTime();
            } else {
                Integer coutYear = Integer.parseInt(year);
                timeKey = coutYear + "-06-30";
                timeKey = coutYear+1 + "-06-30";
            }
        }
//        timeKey= "2017-11-01 00:00:00";
        //及时回复数
        List<SaveModel> relyVal = elasticsearchUtil.findListDateQuotaLevel0(null, timeKey, area, level, "23", "2", lowLevel);
        List<SaveModel> relyVal = elasticsearchUtil.findListDateQuotaLevel0(timeKey, timeKey, area, level, "23", "2", lowLevel);
        //咨询总数
        List<SaveModel> relyTotal = elasticsearchUtil.findListDateQuotaLevel0(null, timeKey, area, level, "3", "2", lowLevel);
        List<SaveModel> relyTotal = elasticsearchUtil.findListDateQuotaLevel0(timeKey, timeKey, area, level, "3", "2", lowLevel);
        //未回复数
        List<SaveModel> noRelyTotal = elasticsearchUtil.findListDateQuotaLevel0(null, timeKey, area, level, "22", "2", lowLevel);
        List<SaveModel> noRelyTotal = elasticsearchUtil.findListDateQuotaLevel0(timeKey, timeKey, area, level, "22", "2", lowLevel);
//        JSONArray rely = new JSONArray(relyVal);
//        JSONArray total = new JSONArray(relyTotal);
//        JSONArray noRely = new JSONArray(noRelyTotal);
        result.put("resultList", getCoutList(level, relyVal, relyTotal, noRelyTotal));
        result.put("resultList", getCoutList(level, lowLevel, relyVal, relyTotal, noRelyTotal));
        return result;
    }
@ -1739,18 +1782,19 @@ public class StatisticsESService {
     * @param onRely
     * @return
     */
    public List<Map<String, Object>> getCoutList(Integer level, List<SaveModel> rely, List<SaveModel> total, List<SaveModel> onRely) {
    public List<Map<String, Object>> getCoutList(Integer level, String lowLevel,List<SaveModel> rely, List<SaveModel> total, List<SaveModel> onRely) {
        Map<String, Object> relyMap = new HashMap<>();
        Map<String, Object> totalMap = new HashMap<>();
        Map<String, Object> onRelyMap = new HashMap<>();
        JSONObject result = new JSONObject();
        String low_level=StringUtils.isEmpty(lowLevel)?String.valueOf(level+1):lowLevel;
        //转换回复数
        for (SaveModel saveModel : rely) {
            if (level == 4) {
            if (SaveModel.teamLevel.equals(low_level)) {
                relyMap.put(saveModel.getTeam(), saveModel);
            } else if (level == 3) {
            } else if (SaveModel.OrgLevel.equals(low_level)) {
                relyMap.put(saveModel.getHospital(), saveModel);
            } else if (level == 2) {
            } else if (SaveModel.townLevel.equals(low_level)) {
                relyMap.put(saveModel.getTown(), saveModel);
            }
        }
@ -1758,22 +1802,22 @@ public class StatisticsESService {
        //转换总咨询数
        for (SaveModel saveModel : total) {
            if (level == 4) {
            if (SaveModel.teamLevel.equals(low_level)) {
                totalMap.put(saveModel.getTeam(), saveModel);
            } else if (level == 3) {
            } else if (SaveModel.OrgLevel.equals(low_level)) {
                totalMap.put(saveModel.getHospital(), saveModel);
            } else if (level == 2) {
            } else if (SaveModel.townLevel.equals(low_level)) {
                totalMap.put(saveModel.getTown(), saveModel);
            }
        }
        ;
        //转换总咨询数
        for (SaveModel saveModel : onRely) {
            if (level == 4) {
            if (SaveModel.teamLevel.equals(low_level)) {
                onRelyMap.put(saveModel.getTeam(), saveModel);
            } else if (level == 3) {
            } else if (SaveModel.OrgLevel.equals(low_level)) {
                onRelyMap.put(saveModel.getHospital(), saveModel);
            } else if (level == 2) {
            } else if (SaveModel.townLevel.equals(low_level)) {
                onRelyMap.put(saveModel.getTown(), saveModel);
            }
        }
@ -1792,11 +1836,11 @@ public class StatisticsESService {
            Integer relyNm = relyRs.getResult2().intValue();
            Integer noRelyNm = onRelyRs.getResult2().intValue();
//            rs.put("name", relyRs.get(area+"Name"));
            if (level == 4) {
            if (SaveModel.teamLevel.equals(low_level)) {
                rs.put("name", relyRs.getTeamName());
            } else if (level == 3) {
            } else if (SaveModel.OrgLevel.equals(low_level)) {
                rs.put("name", relyRs.getHospitalName());
            } else if (level == 2) {
            } else if (SaveModel.townLevel.equals(low_level)) {
                rs.put("name", relyRs.getTownName());
            }
            rs.put("noRelyCount", noRelyNm);
@ -1831,7 +1875,7 @@ public class StatisticsESService {
            }
            resultMaps.add(rs);
        }
        if (level == 4) {
        if ((level == 3 && "5".equals(low_level)) || (level == 4) || (level == 3 && "5".equals(low_level))) {
            Map<Integer, Map<String, Object>> leaders = getAllTeamLeaders();
            if (resultMaps != null && resultMaps.size() > 0) {
                for (Map<String, Object> r : resultMaps) {
@ -1867,12 +1911,11 @@ public class StatisticsESService {
            if (Constant.getNowYear().equals(year)) {
                quotaTime = elasticsearchUtil.getQuotaTime();
            } else {
                quotaTime = year + "-6-30 00:00:00";
                quotaTime = Integer.valueOf(year)+1 + "-6-30";
            }
        }
//        quotaTime = "2017-10-19 00:00:00";
        List<SaveModel> list = elasticsearchUtil.findOneDateQuotaLevel1(null, quotaTime, area, Integer.parseInt(level), "24", "2");
        List<SaveModel> list = elasticsearchUtil.findOneDateQuotaLevel1(quotaTime, quotaTime, area, Integer.parseInt(level), "24", "2");
        JSONArray array = new JSONArray();
        for (SaveModel saveModel : list) {
            JSONObject jsonObject = new JSONObject();
@ -1897,7 +1940,7 @@ public class StatisticsESService {
        JSONObject result = new JSONObject();
        String quotaDate = elasticsearchUtil.getQuotaTime();
        if(!Constant.getNowYear().equals(year)){
            quotaDate = year + "-06-30";
            quotaDate = Integer.valueOf(year)+1 + "-06-30";
        }
        SaveModel relyVal = elasticsearchUtil.findOneDateQuotaLevel0(quotaDate, quotaDate, area, level, "23", "2");
@ -2153,13 +2196,13 @@ public class StatisticsESService {
//        Map<String, Object> expenseStatus1Sigjn = getByIndexSingle(date, area, level, "1",dateFormat);
        SaveModel expenseStatus1Sigjn = elasticsearchUtil.findOneDateQuotaLevel0(date, area, level, "1", "2");
        JSONObject jsonObject = new JSONObject();
        if (Integer.valueOf(SaveModel.teamLevel)==level) {
        if (SaveModel.teamLevel.equals(level)) {
            jsonObject.put("name", expenseStatus1Sigjn.getTeamName());
        } else if (Integer.valueOf(SaveModel.OrgLevel)==level) {
        } else if (SaveModel.OrgLevel.equals(level)) {
            jsonObject.put("name", expenseStatus1Sigjn.getHospitalName());
        } else if (Integer.valueOf(SaveModel.townLevel)==level) {
        } else if (SaveModel.townLevel.equals(level)) {
            jsonObject.put("name", expenseStatus1Sigjn.getTownName());
        } else if (Integer.valueOf(SaveModel.cityLevel)==level) {
        } else if (SaveModel.cityLevel.equals(level)) {
            jsonObject.put("name", expenseStatus1Sigjn.getCityName());
        }
        jsonObject.put("code", area);
@ -2247,10 +2290,10 @@ public class StatisticsESService {
        if (StringUtils.isEmpty(lowCode)) {
            //续签量
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index, "2", "", low_level);
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index, "2", "", lowLevel);
        } else {
            //续签量
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index, "2", lowCode, "", low_level);
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(timeKey, timeKey, area, level, index, "2",1, lowCode, "", low_level);
        }
        if (renewSaveModels != null && renewSaveModels.size() > 0) {
@ -2275,17 +2318,17 @@ public class StatisticsESService {
            //查询去年的签约转map
            List<SaveModel> yearsList = new ArrayList();
            if (StringUtils.isBlank(lowCode)) {
                yearsList = elasticsearchUtil.findListDateQuotaLevel0(lastDate,lastDate,area,level,"1","2",low_level);
                yearsList = elasticsearchUtil.findListDateQuotaLevel0(lastDate, "", Integer.valueOf(low_level), "1", "2", "");
            } else {
                if ("3".equals(lowCode)) {
                    //老年人
                    yearsList = elasticsearchUtil.findListDateQuotaLevel1(lastDate, lastDate, level, "17", "2", low_level, "3");
                    yearsList = elasticsearchUtil.findListDateQuotaLevel1(lastDate, "", Integer.valueOf(low_level), "17", "2", "", "3");
                } else if ("4".equals(lowCode)) {
                    //高血压
                    yearsList = elasticsearchUtil.findListDateQuotaLevel1(lastDate, "", level, "17", "2", low_level, "1");
                    yearsList = elasticsearchUtil.findListDateQuotaLevel1(lastDate, "", Integer.valueOf(low_level), "17", "2", "", "1");
                } else if ("5".equals(lowCode)) {
                    //糖尿病
                    yearsList = elasticsearchUtil.findListDateQuotaLevel1(lastDate, "", level, "17", "2", low_level, "2");
                    yearsList = elasticsearchUtil.findListDateQuotaLevel1(lastDate, "", Integer.valueOf(low_level), "17", "2", "", "2");
                } else {
                }
            }
@ -2304,28 +2347,26 @@ public class StatisticsESService {
            for (Map<String, Object> reMap : resultList) {
                reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
                int signNum = 0;
                Integer renewNum = null;
                int renewNum = 0;
                //获取去年签约的人数 默认是上个年度的最后一天
                if (resultMap != null && resultMap.size() > 0) {
                    SaveModel one = resultMap.get(String.valueOf(reMap.get("code")));
                    SaveModel one = resultMap.get(reMap.get("code").toString());
                    if (one != null) {
                        signNum = one.getResult2().intValue();
                    }
                } else {
                }
                if (renewMap != null && renewMap.size() > 0) {;
                    renewNum = renewMap.get(String.valueOf(reMap.get("code")));
                    if(renewNum==null){
                        renewNum=0;
                    }
                if (renewMap != null && renewMap.size() > 0) {
                    renewNum = renewMap.get(reMap.get("code").toString());
                } else {
                }
                reMap.put("renewNum", renewNum);
                reMap.put("signNum", signNum);
                reMap.put("rate", getRange(renewNum, signNum, 2));//续签率是 续签量/去年的签约数
            }
            if ((level == 2 && "5".equals(low_level)) || (level == 4) || (level == 3 && "5".equals(low_level))) {
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
                translateTeamLeaderName(resultList);
            }
            //对结果进行排序
@ -2768,83 +2809,84 @@ public class StatisticsESService {
    public Map<String, Object> getPrescriptionCount(int level, String area, String disease) throws Exception {
        String index = "58";
        Map<String, Object> rs = new HashedMap();
        List<SaveModel> totalList = null;
        List<SaveModel> processingList = null;
        List<SaveModel> finishedList = null;
        List<SaveModel> canceledList = null;
        List<SaveModel> unPassList = null;
        List<SaveModel> otherList = null;
        SaveModel total = null;
        SaveModel processing = null;
        SaveModel finished = null;
        SaveModel canceled = null;
        SaveModel unPass = null;
        SaveModel other = null;
        String quotaDate = elasticsearchUtil.getQuotaTime();
        //总数
        if (StringUtils.isNotBlank(disease)) {
            totalList = elasticsearchUtil.findListDateQuotaLevel1(null, area, level, index, "2", null, disease);
            total = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index, "2", disease);
        } else {
            totalList = elasticsearchUtil.findListDateQuotaLevel0(null, area, level, index, "2", null);
            total = elasticsearchUtil.findOneDateQuotaLevel0(quotaDate, area, level, index, "2");
        }
        //进行中
        if (StringUtils.isNotBlank(disease)) {
            processingList = elasticsearchUtil.findListDateQuotaLevel2(null, area, level, index, "2", null, disease, "1");
            processing = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index, "2",  disease, "1");
        } else {
            processingList = elasticsearchUtil.findListDateQuotaLevel1(null, area, level, index, "2", null, "1");
            processing = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index, "2", "1");
        }
        //已完成
        if (StringUtils.isNotBlank(disease)) {
            finishedList = elasticsearchUtil.findListDateQuotaLevel2(null, area, level, index, "2", null, disease, "2");
            finished = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index, "2",  disease, "2");
        } else {
            finishedList = elasticsearchUtil.findListDateQuotaLevel1(null, area, level, index, "2", null, "2");
            finished = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index, "2", "2");
        }
        //已经取消
        if (StringUtils.isNotBlank(disease)) {
            canceledList = elasticsearchUtil.findListDateQuotaLevel2(null, area, level, index, "2", null, disease, "3");
            canceled = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index, "2",  disease, "3");
        } else {
            canceledList = elasticsearchUtil.findListDateQuotaLevel1(null, area, level, index, "2", null, "3");
            canceled = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index, "2", "3");
        }
        //审核不通过
        if (StringUtils.isNotBlank(disease)) {
            unPassList = elasticsearchUtil.findListDateQuotaLevel2(null, area, level, index, "2", null, disease, "4");
            unPass = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index, "2",  disease, "4");
        } else {
            unPassList = elasticsearchUtil.findListDateQuotaLevel1(null, area, level, index, "2", null, "4");
            unPass = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index, "2", "4");
        }
        //其他原因取消
        if (StringUtils.isNotBlank(disease)) {
            otherList = elasticsearchUtil.findListDateQuotaLevel2(null, area, level, index, "2", null, disease, "5");
            other = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, level, index, "2",  disease, "5");
        } else {
            otherList = elasticsearchUtil.findListDateQuotaLevel1(null, area, level, index, "2", null, "5");
            other = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, level, index, "2", "5");
        }
        //总数
        if (totalList != null && totalList.size() > 0) {
            rs.put("total", totalList.get(0).getResult2());
        if (total != null) {
            rs.put("total", total.getResult2());
        } else {
            rs.put("total", 0);
        }
        //进行中
        if (processingList != null && processingList.size() > 0) {
            rs.put("processingCount", processingList.get(0).getResult2());
        if (processing != null) {
            rs.put("processingCount", processing.getResult2());
        } else {
            rs.put("processingCount", 0);
        }
        //已完成
        if (finishedList != null && finishedList.size() > 0) {
            rs.put("finishCount", finishedList.get(0).getResult2());
        if (finished != null) {
            rs.put("finishCount", finished.getResult2());
        } else {
            rs.put("finishCount", 0);
        }
        //已取消
        if (canceledList != null && canceledList.size() > 0) {
            rs.put("patientCancelCount", canceledList.get(0).getResult2());
        if (canceled != null) {
            rs.put("patientCancelCount", canceled.getResult2());
        } else {
            rs.put("patientCancelCount", 0);
        }
        //审核不通过
        if (unPassList != null && unPassList.size() > 0) {
            rs.put("noReviewedCount", unPassList.get(0).getResult2());
        if (unPass != null) {
            rs.put("noReviewedCount", unPass.getResult2());
        } else {
            rs.put("noReviewedCount", 0);
        }
        //其他原因取消
        if (otherList != null && otherList.size() > 0) {
            rs.put("payOuttimeCount", otherList.get(0).getResult2());
        if (other != null) {
            rs.put("payOuttimeCount", other.getResult2());
        } else {
            rs.put("payOuttimeCount", 0);
        }
@ -2924,7 +2966,7 @@ public class StatisticsESService {
    public List<Map<String, Object>> getPrescriptionAgeLowLevel(String level, String lowlevel, String area, String disease) throws Exception {
        String quotaDate = elasticsearchUtil.getQuotaTime();
        List<SaveModel> list = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, Integer.parseInt(level), "58", "2", lowlevel, disease);
        List<SaveModel> list = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, Integer.parseInt(level), "63", "2", lowlevel, disease);
        Map<String, Object> map = null;
        List<Map<String, Object>> rs = new ArrayList<>();
        if (list.size() > 0) {
@ -3020,18 +3062,28 @@ public class StatisticsESService {
        Long num = (Long) count.get("num");
        Map<String, Object> map = new HashMap<>();
        DecimalFormat decimalFormat = new DecimalFormat("0.00");//构造方法的字符格式这里如果小数不足2位,会以0补足.
        Double ageRate = list.get(0).getResult2() / num;
        map.put("0ageRate", decimalFormat.format(ageRate));
        ageRate = list.get(1).getResult2() / num;
        map.put("7ageRate", decimalFormat.format(ageRate));
        ageRate = list.get(2).getResult2() / num;
        map.put("19ageRate", decimalFormat.format(ageRate));
        ageRate = list.get(3).getResult2() / num;
        map.put("31ageRate", decimalFormat.format(ageRate));
        ageRate = list.get(4).getResult2() / num;
        map.put("51ageRate", decimalFormat.format(ageRate));
        ageRate = list.get(5).getResult2() / num;
        map.put("65ageRate", decimalFormat.format(ageRate));
        if(num==0){
            map.put("0ageRate", 0.0);
            map.put("7ageRate", 0.0);
            map.put("19ageRate", 0.0);
            map.put("31ageRate", 0.0);
            map.put("51ageRate", 0.0);
            map.put("65ageRate", 0.0);
        }else{
            Double ageRate = list.get(0).getResult2() / num;
            map.put("0ageRate", decimalFormat.format(ageRate));
            ageRate = list.get(1).getResult2() / num;
            map.put("7ageRate", decimalFormat.format(ageRate));
            ageRate = list.get(2).getResult2() / num;
            map.put("19ageRate", decimalFormat.format(ageRate));
            ageRate = list.get(3).getResult2() / num;
            map.put("31ageRate", decimalFormat.format(ageRate));
            ageRate = list.get(4).getResult2() / num;
            map.put("51ageRate", decimalFormat.format(ageRate));
            ageRate = list.get(5).getResult2() / num;
            map.put("65ageRate", decimalFormat.format(ageRate));
        }
        return map;
    }
@ -3066,16 +3118,16 @@ public class StatisticsESService {
            //类型0.总量,1.进行中,2.已完成,3.居民取消,4.审核不通过,5.其他原因取消
            if ("0".equals(type)) {
                //总数
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index, "2", "3", disease);
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index, "1", "3", disease);
            } else {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index, "2", "3", disease, type);
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, index, "1", "3", disease, type);
            }
        } else {
            if ("0".equals(type)) {
                //总数
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel0(startTime, endTime, area, level, index, "2", "3");
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel0(startTime, endTime, area, level, index, "1", "3");
            } else {
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, index, "2", "3", type);
                resultList = elasticsearchUtil.findLineChartDateQuotaLevel1Key2(startTime, endTime, area, level, index, "1", "3", type);
            }
        }
@ -3087,6 +3139,7 @@ public class StatisticsESService {
                String monthKeyEs = "";
                if (saveModel.getQuotaDate() != null) {
                    monthKeyEs = DateUtil.changeQuotaDate(saveModel.getQuotaDate());
                    m.put("month", monthKeyEs);
                }
                if (StringUtils.isNotBlank(monthKeyEs) && monthKey.equals(monthKeyEs)) {
                    m.put("count", saveModel.getResult2());
@ -3115,24 +3168,44 @@ public class StatisticsESService {
        //一级维度
        if (StringUtils.isEmpty(disease)) {
            //类型 1.总量,2.已完成,3.居民取消,4.审核不通过,5.进行中,6.其他原因取消
//            if ("1".equals(type)) {
//                saveModels = elasticsearchUtil.findListDateQuotaLevel0(quotaDate, area, level, index, "2", lowlevel);
//            } else if ("2".equals(type) || "3".equals(type) || "4".equals(type)) {
//                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index, "2", lowlevel, type);
//            } else if ("5".equals(type)) {
//                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index, "2", lowlevel, "1");
//            } else if ("6".equals(type)) {
//                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index, "2", lowlevel, "5");
//            }
            if ("1".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel0(quotaDate, area, level, index, "2", lowlevel);
            } else if ("2".equals(type) || "3".equals(type) || "4".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index, "2", lowlevel, type);
            } else if ("5".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index, "2", lowlevel, "1");
                //总数
                saveModels = elasticsearchUtil.findListDateQuotaLevel0(quotaDate,area,level,index,"2",lowlevel);
            } else if("2".equals(type) || "3".equals(type) || "4".equals(type)){
                saveModels = elasticsearchUtil.findListDateQuotaLevel1Key2(quotaDate,area,level,index,"2",lowlevel,type);
            } else if("5".equals(type)){
                saveModels = elasticsearchUtil.findListDateQuotaLevel1Key2(quotaDate,area,level,index,"2",lowlevel,"1");
            } else if ("6".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index, "2", lowlevel, "5");
                saveModels = elasticsearchUtil.findListDateQuotaLevel1Key2(quotaDate,area,level,index,"2",lowlevel,"5");
            }
        } else {
            //类型 1.总量,2.已完成,3.居民取消,4.审核不通过,5.进行中,6.其他原因取消
//            if ("1".equals(type)) {
//                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index, "2", lowlevel, disease);
//            } else if ("2".equals(type) || "3".equals(type) || "4".equals(type)) {
//                saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index, "2", lowlevel, disease, type);
//            } else if ("5".equals(type)) {
//                saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index, "2", lowlevel, disease, "1");
//            } else if ("6".equals(type)) {
//                saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index, "2", lowlevel, disease, "5");
//            }
            if ("1".equals(type)) {
                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index, "2", lowlevel, disease);
            } else if ("2".equals(type) || "3".equals(type) || "4".equals(type)) {
                //总数String quotaDate,  String area, int level, String index, String timelevel,String lowLevel, String slaveKey2
                saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate,area,level,index,"2",lowlevel,disease);
            } else if("2".equals(type) || "3".equals(type) || "4".equals(type)){
                saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index, "2", lowlevel, disease, type);
            } else if ("5".equals(type)) {
            } else if("5".equals(type)){
                saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index, "2", lowlevel, disease, "1");
            } else if ("6".equals(type)) {
            } else if("6".equals(type)){
                saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index, "2", lowlevel, disease, "5");
            }
        }
@ -3225,13 +3298,14 @@ public class StatisticsESService {
     * @return
     */
    public Map<String, Object> getPrescriptionAgeTotal(String level, String area, String disease) throws Exception {
        //统计长处方总数疾病和状态维度(去重相同患者)
        String index ="63";
        String quotaDate = elasticsearchUtil.getQuotaTime();
        //统计年龄分布
        List<SaveModel> list = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, Integer.parseInt(level), "60", "2", disease);
        List<SaveModel> list = elasticsearchUtil.findOneDateQuotaLevel2(quotaDate, area, Integer.parseInt(level), index, "2", disease);
        //总数量
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(quotaDate, area, Integer.parseInt(level), "60", "2");
        SaveModel saveModel = elasticsearchUtil.findOneDateQuotaLevel0(quotaDate, area, Integer.parseInt(level), index, "2");
        Double num = saveModel.getResult2();
        Map<String, Object> map = new HashMap<>();
@ -3261,44 +3335,46 @@ public class StatisticsESService {
    }
    public Map<String, Object> getPrescriptionDispatchingTotal(int level, String area, String disease) throws Exception {
        List<SaveModel> seltList = null;//自取集合
        List<SaveModel> deliveryList = null;//物流配送集合
        List<SaveModel> healthDoctorList = null;//健管师配送集合
        String index = "62";
        SaveModel selt = null;//自取集合
        SaveModel delivery = null;//物流配送集合
        SaveModel healthDoctor = null;//健管师配送集合
        String quotaTime = elasticsearchUtil.getQuotaTime();
        //type二级指标,disease一级指标
        if (StringUtils.isNotBlank(disease)) {
            //自取
            seltList = elasticsearchUtil.findListDateQuotaLevel2(quotaTime, area, level, "62", "2", "", "1", disease);
            selt = elasticsearchUtil.findOneDateQuotaLevel2(quotaTime,area, level, index, "2", disease, "1");
            //物流配送
            deliveryList = elasticsearchUtil.findListDateQuotaLevel2(quotaTime, area, level, "62", "2", "", "2", disease);
            delivery = elasticsearchUtil.findOneDateQuotaLevel2(quotaTime,area, level, index, "2", disease, "2");
            //健管师配送
            healthDoctorList = elasticsearchUtil.findListDateQuotaLevel2(quotaTime, area, level, "62", "2", "", "2", disease);
            healthDoctor = elasticsearchUtil.findOneDateQuotaLevel2(quotaTime,area, level, index, "2", disease, "3");
        } else {
            //自取
            seltList = elasticsearchUtil.findListDateQuotaLevel1(quotaTime, area, level, "62", "2", "", "1");
            selt = elasticsearchUtil.findOneDateQuotaLevel1Key2(quotaTime, area, level, index, "2", "1");
            //物流配送
            deliveryList = elasticsearchUtil.findListDateQuotaLevel1(quotaTime, area, level, "62", "2", "", "2");
            delivery = elasticsearchUtil.findOneDateQuotaLevel1Key2(quotaTime, area, level, index, "2", "2");
            //健管师配送
            healthDoctorList = elasticsearchUtil.findListDateQuotaLevel1(quotaTime, area, level, "62", "2", "", "2");
            healthDoctor = elasticsearchUtil.findOneDateQuotaLevel1Key2(quotaTime, area, level, index, "2", "3");
        }
        Map<String, Object> rs = new HashedMap();
        //自取数目
        if (seltList != null && seltList.size() > 0) {
            rs.put("seltTotal", seltList.get(0).getResult2());
        if (selt != null) {
            rs.put("seltTotal", selt.getResult2());
        } else {
            rs.put("seltTotal", 0);
        }
        //快递配送
        if (deliveryList != null && deliveryList.size() > 0) {
            rs.put("deliveryTotal", deliveryList.get(0).getResult2());
        if (delivery != null) {
            rs.put("deliveryTotal", delivery.getResult2());
        } else {
            rs.put("deliveryTotal", 0);
        }
        //健管师配送
        if (healthDoctorList != null && healthDoctorList.size() > 0) {
            rs.put("doctorTotal", healthDoctorList.get(0).getResult2());
        if (healthDoctor != null) {
            rs.put("doctorTotal", healthDoctor.getResult2());
        } else {
            rs.put("doctorTotal", 0);
        }
@ -3334,9 +3410,9 @@ public class StatisticsESService {
        List<SaveModel> resultList = new ArrayList<>();
        if (StringUtils.isNotBlank(disease)) {
            resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, "62", "2", "3", type, disease);
            resultList = elasticsearchUtil.findLineChartDateQuotaLevel2(startTime, endTime, area, level, "62", "2", "3",disease , type);
        } else {
            resultList = elasticsearchUtil.findLineChartDateQuotaLevel1(startTime, endTime, area, level, "62", "2", "3", type);
            resultList = elasticsearchUtil.findLineChartDateQuotaLevel1Key2(startTime, endTime, area, level, "62", "2", "3", type);
        }
        for (Map<String, Object> m : rs) {
@ -3371,9 +3447,9 @@ public class StatisticsESService {
        List<Map<String, Object>> rs = new ArrayList<>();
        if (StringUtils.isNotBlank(disease)) {
            //类型 1.自取,2.快递配送,3.健管师配送
            saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index, "2", lowlevel, type, disease);
            saveModels = elasticsearchUtil.findListDateQuotaLevel2(quotaDate, area, level, index, "2", lowlevel, disease, type);
        } else {
            saveModels = elasticsearchUtil.findListDateQuotaLevel1(quotaDate, area, level, index, "2", lowlevel, type);
            saveModels = elasticsearchUtil.findListDateQuotaLevel1Key2(quotaDate, area, level, index, "2", lowlevel, type);
        }
        if ("5".equals(lowlevel)) {
            translateTeamLeaderName2(saveModels);
@ -3493,7 +3569,11 @@ public class StatisticsESService {
                    map.put("name", one.getTeamName());
                }
                Long num = (Long) count.get("num");
                String avg = decimalFormat.format(one.getResult1() / num);
                String avg = "0.0";
                if(num!=0){
                    avg = decimalFormat.format(one.getResult1() / num);
                }
                map.put("val", avg);
                countList.add(map);
            }
@ -3521,7 +3601,7 @@ public class StatisticsESService {
        List<Map<String, Object>> countList = new ArrayList<>();
        for (SaveModel one : list) {
            sql = "  select count(DISTINCT(s.patient)) as num from wlyy_prescription_pay p left join wlyy_prescription s on p.prescription_code = s. CODE  ";
            sql += " and  p.trace_time <= " + one.getQuotaDate();
            sql += " and  p.trace_time <= " + dateFormat3.format(one.getQuotaDate());
            if (SaveModel.townLevel.equals(level) || SaveModel.cityLevel.equals(level)) {
                sql += " and LEFT(s.hospital,6) ='" + area + "' ";
            } else if (SaveModel.OrgLevel.equals(level)) {
@ -3531,10 +3611,20 @@ public class StatisticsESService {
            }
            Map<String, Object> count = jdbcTemplate.queryForMap(sql);
            Long num = (Long) count.get("num");
            String avg = decimalFormat.format(one.getResult1() / num);
            String avg = "0.0";
            if(num!=0){
                avg = decimalFormat.format(one.getResult1() / num);
            }
            map = new HashMap<>();
            map.put("avg", avg);
            map.put("date", dateFormat.format(one.getQuotaDate()));
            if("1".equals(type)){
                map.put("date", dateFormat.format(one.getQuotaDate()));
            }else if("2".equals(type)){
                map.put("date", DateUtil.getWeekOfMonth(dateFormat.format(one.getQuotaDate())));
            }else{
                map.put("date", DateUtil.getMonth(dateFormat.format(one.getQuotaDate())));
            }
            countList.add(map);
        }
        return countList;
@ -3542,14 +3632,15 @@ public class StatisticsESService {
    public Map<String, Object> getPrescriptionCost(String level, String area, String disease) throws Exception {
        SaveModel saveModel = null;
        String index = "61";
        String quotaDate = elasticsearchUtil.getQuotaTime();
        if (StringUtils.isNotEmpty(disease)) {
            saveModel = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, Integer.parseInt(level), "61", "2", disease);
            saveModel = elasticsearchUtil.findOneDateQuotaLevel1(quotaDate, area, Integer.parseInt(level), index, "2", disease);
        } else {
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(quotaDate, area, Integer.parseInt(level), "61", "2");
            saveModel = elasticsearchUtil.findOneDateQuotaLevel0(quotaDate, area, Integer.parseInt(level), index, "2");
        }
        String sql = "  select count(DISTINCT(s.patient)) as num from wlyy_prescription_pay p left join wlyy_prescription s on p.prescription_code = s. CODE  ";
        sql += " and  p.trace_time <= " + dateFormat3.parse(quotaDate);
        sql += " and  p.create_time <= " + quotaDate;
        if (SaveModel.townLevel.equals(level) || SaveModel.cityLevel.equals(level)) {
            sql += " and LEFT(s.hospital,6) ='" + area + "' ";
        } else if (SaveModel.OrgLevel.equals(level)) {
@ -3561,7 +3652,13 @@ public class StatisticsESService {
        Long num = (Long) count.get("num");
        Map<String, Object> rs = new HashedMap();
        BigDecimal s = BigDecimal.valueOf(num);
        BigDecimal a = BigDecimal.valueOf(saveModel.getResult2() / num);
        BigDecimal a = null;
        if(num==0){
            a = BigDecimal.valueOf(0.0);
        }else{
            a = BigDecimal.valueOf(saveModel.getResult2().longValue() / num);
        }
        rs.put("sum", s.divide(new BigDecimal(100)).setScale(2, BigDecimal.ROUND_HALF_UP));
        rs.put("avg", a.divide((new BigDecimal(100))).setScale(2, BigDecimal.ROUND_HALF_UP));
        return rs;

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

@ -1107,4 +1107,11 @@ public class DateUtil {
		calendar.setTime(date);
		return calendar.get(Calendar.YEAR)+"";
	}
	public static String getMonth(String dateString){
		Date date = strToDate(dateString);
		return new SimpleDateFormat(YYYY_MM).format(date);
	}
}

+ 62 - 19
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/ElasticsearchUtil.java

@ -50,7 +50,13 @@ public class ElasticsearchUtil {
    public List excute(String sql, Class clazz, String esType, String esIndex) {
        List saveModels = new ArrayList<>();
        try {
            //解决 group by之后默认是200的问题
            if(sql.toLowerCase().contains("group by")){
                sql=sql+" limit 0,2000";
            }
            SQLExprParser parser = new ElasticSqlExprParser(sql);
            SQLExpr expr = parser.expr();
            SQLQueryExpr queryExpr = (SQLQueryExpr) expr;
@ -328,14 +334,23 @@ public class ElasticsearchUtil {
     * @param level     等级
     * @param index     指标
     * @param timeLevel 1增量 2到达量
     * @param slaveKey1 一级维度
     * @param slaveKeyValue 一级维度
     * @param interval  1日 2周 3月
     * @param lowLevel  下个等级
     * @return
     * @throws Exception
     */
    public List findDateQuotaLevel1(String startDate, String endDate, String area, int level, String index, String timeLevel, String slaveKey1, String interval, String lowLevel) throws Exception {
    public List findDateQuotaLevel1(String startDate, String endDate, String area, int level, String index, String timeLevel,int keyNum, String slaveKeyValue, String interval, String lowLevel) throws Exception {
        String slaveKey = "";
        String slaveKeyName = "";
        if(keyNum==1){
            slaveKey = "slaveKey1";
            slaveKeyName = "slaveKey1Name";
        }else if(keyNum==2){
            slaveKey = "slaveKey2";
            slaveKeyName = "slaveKey2Name";
        }
        //时间格式转换  yyyy-MM-dd转成 2017-07-17T00:00:00+0800
        if (StringUtils.isNotEmpty(startDate)) {
            if(startDate.length()>10){
@ -358,17 +373,17 @@ public class ElasticsearchUtil {
            low_level = lowLevel;
        }
        if (SaveModel.teamLevel.equals(low_level)) {
            sql.append("select team,teamName,slaveKey1,slaveKey1Name,sum(result1) result1, sum(result2) result2 from "+esIndex+" where ");
            groupBy.append("  group by team,teamName,slaveKey1,slaveKey1Name");
            sql.append("select team,teamName,"+slaveKey+","+slaveKeyName+",sum(result1) result1, sum(result2) result2 from "+esIndex+" where ");
            groupBy.append("  group by team,teamName,"+slaveKey+","+slaveKeyName);
        } else if (SaveModel.OrgLevel.equals(low_level)) {
            sql.append("select hospital,hospitalName,slaveKey1,slaveKey1Name,sum(result1) result1,sum(result2) result2 from "+esIndex+" where ");
            groupBy.append("  group by hospital,hospitalName,slaveKey1,slaveKey1Name");
            sql.append("select hospital,hospitalName,"+slaveKey+","+slaveKeyName+",sum(result1) result1,sum(result2) result2 from "+esIndex+" where ");
            groupBy.append("  group by hospital,hospitalName,"+slaveKey+","+slaveKeyName);
        } else if (SaveModel.townLevel.equals(low_level)) {
            sql.append("select town,townName,slaveKey1,slaveKey1Name,sum(result1) result1,sum(result2) result2 from "+esIndex+" where ");
            groupBy.append("  group by town,townName,slaveKey1,slaveKey1Name");
            sql.append("select town,townName,"+slaveKey+",slaveKey1Name,sum(result1) result1,sum(result2) result2 from "+esIndex+" where ");
            groupBy.append("  group by town,townName,"+slaveKey+","+slaveKeyName);
        } else if (SaveModel.cityLevel.equals(low_level)) {
            sql.append("select city,cityName,slaveKey1,slaveKey1Name,sum(result1) result1,sum(result2) result2 from "+esIndex+" where ");
            groupBy.append("  group by city,cityName,slaveKey1,slaveKey1Name");
            sql.append("select city,cityName,"+slaveKey+","+slaveKeyName+",sum(result1) result1,sum(result2) result2 from "+esIndex+" where ");
            groupBy.append("  group by city,cityName,"+slaveKey+","+slaveKeyName);
        }
        if(StringUtils.isNotEmpty(area)){
@ -393,8 +408,8 @@ public class ElasticsearchUtil {
        if (StringUtils.isNotEmpty(endDate)) {
            sql.append(" and quotaDate<='" + endDate + "'");
        }
        if (StringUtils.isNotEmpty(slaveKey1)) {
            sql.append(" and slaveKey1='" + slaveKey1 + "'  ");
        if (StringUtils.isNotEmpty(slaveKeyValue)) {
            sql.append(" and "+slaveKey+"='" + slaveKeyValue + "'  ");
        }
        //根据时间维度分组
@ -592,7 +607,11 @@ public class ElasticsearchUtil {
     * @return
     */
    public SaveModel findOneDateQuotaLevel1(String quotaDate, String area, int level, String index, String timelevel, String slaveKey1) throws Exception {
        List list = findDateQuotaLevel1(quotaDate, quotaDate, area, level, index, timelevel,slaveKey1, null, null);
        List list = findDateQuotaLevel1(quotaDate, quotaDate, area, level, index, timelevel,1,slaveKey1, null, null);
        return (SaveModel) list.get(0);
    }
    public SaveModel findOneDateQuotaLevel1Key2(String quotaDate, String area, int level, String index, String timelevel, String slaveKey1) throws Exception {
        List list = findDateQuotaLevel1(quotaDate, quotaDate, area, level, index, timelevel,2,slaveKey1, null, null);
        return (SaveModel) list.get(0);
    }
    /**
@ -609,7 +628,11 @@ public class ElasticsearchUtil {
     * @return
     */
    public SaveModel findOneDateQuotaLevel1(String startDate, String endDate, String area, int level, String index, String timelevel, String slaveKey1) throws Exception {
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,slaveKey1, null, null);
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,1,slaveKey1, null, null);
        return (SaveModel) list.get(0);
    }
    public SaveModel findOneDateQuotaLevel1Key2(String startDate, String endDate, String area, int level, String index, String timelevel, String slaveKey1) throws Exception {
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,2,slaveKey1, null, null);
        return (SaveModel) list.get(0);
    }
@ -625,7 +648,11 @@ public class ElasticsearchUtil {
     * @return
     */
    public List<SaveModel> findOneDateQuotaLevel1(String quotaDate, String area, int level, String index, String timelevel) throws Exception {
        List list = findDateQuotaLevel1(quotaDate, quotaDate, area, level, index, timelevel,null, null, null);
        List list = findDateQuotaLevel1(quotaDate, quotaDate, area, level, index, timelevel,1,null, null, null);
        return list;
    }
    public List<SaveModel> findOneDateQuotaLevel1key2(String quotaDate, String area, int level, String index, String timelevel) throws Exception {
        List list = findDateQuotaLevel1(quotaDate, quotaDate, area, level, index, timelevel,2,null, null, null);
        return list;
    }
    /**
@ -639,7 +666,11 @@ public class ElasticsearchUtil {
     * @return
     */
    public List<SaveModel> findOneDateQuotaLevel1(String startDate,String endDate, String area, int level, String index, String timelevel) throws Exception {
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,null, null, null);
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,1,null, null, null);
        return list;
    }
    public List<SaveModel> findOneDateQuotaLevel1Key2(String startDate,String endDate, String area, int level, String index, String timelevel) throws Exception {
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,2,null, null, null);
        return list;
    }
    /**
@ -729,7 +760,11 @@ public class ElasticsearchUtil {
     * @return
     */
    public  List<SaveModel>  findLineChartDateQuotaLevel1(String startDate,String endDate,  String area, int level, String index, String timelevel,String interval, String slaveKey1) throws Exception {
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,slaveKey1, interval, null);
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,1,slaveKey1, interval, null);
        return list;
    }
    public  List<SaveModel>  findLineChartDateQuotaLevel1Key2(String startDate,String endDate,  String area, int level, String index, String timelevel,String interval, String slaveKey2) throws Exception {
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,2,slaveKey2, interval, null);
        return list;
    }
    /**
@ -803,7 +838,11 @@ public class ElasticsearchUtil {
     * @return
     */
    public  List<SaveModel>  findListDateQuotaLevel1(String quotaDate,  String area, int level, String index, String timelevel,String lowLevel, String slaveKey1) throws Exception {
        List list = findDateQuotaLevel1(quotaDate, quotaDate, area, level, index, timelevel,slaveKey1, null, lowLevel);
        List list = findDateQuotaLevel1(quotaDate, quotaDate, area, level, index, timelevel,1,slaveKey1, null, lowLevel);
        return list;
    }
    public  List<SaveModel>  findListDateQuotaLevel1Key2(String quotaDate,  String area, int level, String index, String timelevel,String lowLevel, String slaveKey2) throws Exception {
        List list = findDateQuotaLevel1(quotaDate, quotaDate, area, level, index, timelevel,2,slaveKey2, null, lowLevel);
        return list;
    }
    /**
@ -822,7 +861,11 @@ public class ElasticsearchUtil {
     * @return
     */
    public  List<SaveModel>  findListDateQuotaLevel1(String startDate,String endDate,  String area, int level, String index, String timelevel,String lowLevel, String slaveKey1) throws Exception {
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,slaveKey1, null, lowLevel);
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,1,slaveKey1, null, lowLevel);
        return list;
    }
    public  List<SaveModel>  findListDateQuotaLevel1Key2(String startDate,String endDate,  String area, int level, String index, String timelevel,String lowLevel, String slaveKey2) throws Exception {
        List list = findDateQuotaLevel1(startDate, endDate, area, level, index, timelevel,2,slaveKey2, null, lowLevel);
        return list;
    }
    /**

+ 15 - 17
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/FileUploadController.java

@ -1,24 +1,15 @@
package com.yihu.wlyy.web.common;
import java.io.*;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.*;
import javax.servlet.ServletRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.wlyy.util.*;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImageCompress;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.fastdfs.FastDFSUtil;
import com.yihu.wlyy.web.third.gateway.vo.UploadModel;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultOneModel;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.codec.EncoderException;
import org.apache.commons.io.FileUtils;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
@ -27,7 +18,6 @@ import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -43,10 +33,17 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.yihu.wlyy.web.BaseController;
import org.springframework.web.multipart.MultipartRequest;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.*;
@Controller
@RequestMapping(value = "/upload", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "文件上传")
@ -512,6 +509,7 @@ public class FileUploadController extends BaseController {
            }
            return responseEntity;
        } catch (Exception e) {
            error(e);
            return error(-1, "上传失败");
        }
    }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/area/AreaController.java

@ -1,7 +1,6 @@
package com.yihu.wlyy.web.common.area;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.service.app.label.SignPatientLabelInfoService;
import com.yihu.wlyy.service.common.area.AreaService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -37,6 +36,7 @@ public class AreaController extends BaseController {
            List<Town> towns = areaService.getCityTowns(city);
            return write(200, "查询成功", "data", towns == null ? new ArrayList<Town>() : towns);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/device/DeviceController.java

@ -59,6 +59,7 @@ public class DeviceController extends BaseController {
            return write(200, "查询成功", "data", device);
        } catch (Exception ex) {
            error(ex);
            return invalidUserException(ex, -1, ex.getMessage());
        }
    }

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/health/HealthEduArticlesController.java

@ -55,6 +55,7 @@ public class HealthEduArticlesController extends BaseController{
            }
            return write(-1, "数据导入失败!");
        }catch (Exception e){
            error(e);
            return error(-1, "数据导入失败!");
        }

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/hospital/HospitalCommonController.java

@ -29,6 +29,7 @@ public class HospitalCommonController extends BaseController {
            List<Hospital> hospitals = hospitalService.getHositalByTownCode(town);
            return write(200, "查询成功", "data", hospitals == null ? new ArrayList<Hospital>() : hospitals);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -40,6 +41,7 @@ public class HospitalCommonController extends BaseController {
            List<Hospital> hospitals = hospitalService.getHospitalsNot00(getUID());
            return write(200, "查询成功", "data", hospitals == null ? new ArrayList<Hospital>() : hospitals);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/icd/Icd10Controller.java

@ -25,6 +25,7 @@ public class Icd10Controller extends BaseController {
        try {
            return write(200, "查询成功", "data", icd10DictServcie.getIcd10Name(code));
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -47,6 +48,7 @@ public class Icd10Controller extends BaseController {
        try {
            return write(200, "查询成功", "data", icd10DictServcie.getHealthProblemName(code));
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -59,6 +61,7 @@ public class Icd10Controller extends BaseController {
        try {
            return write(200, "查询成功", "data", icd10DictServcie.getHealthProblemsByIcd10Code(code));
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -70,6 +73,7 @@ public class Icd10Controller extends BaseController {
            icd10DictServcie.cacheDict();
            return write(200, "查询成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }

+ 1 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/im/imController.java

@ -48,6 +48,7 @@ public class imController extends BaseController {
        try {
            return success(ImUtill.getTopic(consult).get("data").toString());
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }

+ 9 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/qrcode/QrCodeController.java

@ -42,6 +42,7 @@ public class QrCodeController extends WeixinBaseController {
                return error(-1, "生成二维码失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "生成二维码失败!");
        }
    }
@ -62,6 +63,7 @@ public class QrCodeController extends WeixinBaseController {
                return error(-1, "生成二维码失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "生成二维码失败!");
        }
    }
@ -82,6 +84,7 @@ public class QrCodeController extends WeixinBaseController {
                return error(-1, "生成二维码失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "生成二维码失败!");
        }
    }
@ -102,6 +105,7 @@ public class QrCodeController extends WeixinBaseController {
                return error(-1, "生成二维码失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "生成二维码失败!");
        }
    }
@ -145,7 +149,7 @@ public class QrCodeController extends WeixinBaseController {
                response.setStatus(404);
            }
        } catch (Exception e) {
            error(e);
        }
    }
@ -287,6 +291,7 @@ public class QrCodeController extends WeixinBaseController {
                throw new Exception("医生信息不存在!");
            }
        } catch (Exception e) {
            error(e);
            response.setStatus(500);
        }
    }
@ -322,6 +327,7 @@ public class QrCodeController extends WeixinBaseController {
                response.setStatus(500);
            }
        } catch (Exception e) {
            error(e);
            response.setStatus(500);
        }
    }
@ -357,6 +363,7 @@ public class QrCodeController extends WeixinBaseController {
                response.setStatus(500);
            }
        } catch (Exception e) {
            error(e);
            response.setStatus(500);
        }
    }
@ -392,6 +399,7 @@ public class QrCodeController extends WeixinBaseController {
                response.setStatus(500);
            }
        } catch (Exception e) {
            error(e);
            response.setStatus(500);
        }
    }

+ 3 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/CaptchaController.java

@ -50,6 +50,7 @@ public class CaptchaController extends BaseController {
        try{
            return generateCaptcha();
        } catch (Exception e){
            error(e);
            return error(500, e.getMessage());
        }
    }
@ -62,6 +63,7 @@ public class CaptchaController extends BaseController {
            return generateCaptcha();
        } catch (Exception e){
            error(e);
            return error(500, e.getMessage());
        }
    }
@ -80,6 +82,7 @@ public class CaptchaController extends BaseController {
            return write(200, "ok", "pass", pass);
        } catch (Exception e){
            error(e);
            return error(500, e.getMessage());
        }
    }

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/ManagerUtilController.java

@ -63,6 +63,7 @@ public class ManagerUtilController extends BaseController {
            diseaseService.updateToRedis();
            return write(200, "更新成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "更新失败");
        }
    }
@ -78,6 +79,7 @@ public class ManagerUtilController extends BaseController {
            diseaseService.updateToDisease();
            return write(200, "更新成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "更新失败");
        }
    }
@ -93,6 +95,7 @@ public class ManagerUtilController extends BaseController {
        try {
            return write(200, "查询成功", "data", redisTemplate.opsForValue().get("disease:" + patient));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -111,6 +114,7 @@ public class ManagerUtilController extends BaseController {
            workTimeService.consultTimesRemain(new SimpleDateFormat("yyyy-MM-dd").format(new Date()));
            return write(200, "更新成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "更新失败");
        }
    }
@ -127,6 +131,7 @@ public class ManagerUtilController extends BaseController {
            statisticsService.peopleNumToRedis(year);
            return write(200, "更新成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "更新失败");
        }
    }
@ -142,6 +147,7 @@ public class ManagerUtilController extends BaseController {
            manageUtilService.signPatientSetGroup();
            return write(200, "更新成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "更新失败");
        }
    }
@ -157,6 +163,7 @@ public class ManagerUtilController extends BaseController {
            manageUtilService.setSignTeamAndGroupByPage(page);
            return write(200, "更新成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "更新失败");
        }
    }
@ -172,6 +179,7 @@ public class ManagerUtilController extends BaseController {
            manageUtilService.setSignTeamAndGroupById(id);
            return write(200, "更新成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "更新失败");
        }
    }
@ -192,6 +200,7 @@ public class ManagerUtilController extends BaseController {
                return write(200, "查询成功", "data", ManageUtilService.errorSigns);
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -208,6 +217,7 @@ public class ManagerUtilController extends BaseController {
                    .setEnd(end).setStart(start)).start();
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "启动失败");
        }
    }
@ -224,6 +234,7 @@ public class ManagerUtilController extends BaseController {
            manageUtilService.transformEduArticle();
            return write(200, "启动成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "启动失败");
        }
    }
@ -262,6 +273,7 @@ public class ManagerUtilController extends BaseController {
            jo.put("patient_online", SystemData.patientTokens.size());
            return write(200, "启动成功","data",jo);
        } catch (Exception e) {
            error(e);
            return error(-1, "启动失败");
        }
    }
@ -280,6 +292,7 @@ public class ManagerUtilController extends BaseController {
            GateWayInterceptor.status = close;
            return write(200, "关闭成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "启动失败");
        }
    }
@ -294,6 +307,7 @@ public class ManagerUtilController extends BaseController {
            GateWayInterceptor.status = open;
            return write(200, "开启成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "启动失败");
        }
    }
@ -320,6 +334,7 @@ public class ManagerUtilController extends BaseController {
            }
            return write(200, "关闭成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "启动失败");
        }
    }
@ -346,6 +361,7 @@ public class ManagerUtilController extends BaseController {
            }
            return write(200, "开启成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "启动失败");
        }
    }

+ 8 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/util/WlyySerivceController.java

@ -3,7 +3,6 @@ package com.yihu.wlyy.web.common.util;
import com.yihu.wlyy.service.third.guahao.GuahaoXMService;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.util.HttpUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -12,13 +11,14 @@ import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by lyr on 2016/9/29.
@ -56,6 +56,7 @@ public class WlyySerivceController extends BaseController{
                return write(200,"调用成功","data",jsonString);
            }
        }catch (Exception e){
            error(e);
            return error(-1,"调用失败");
        }
    }
@ -101,6 +102,7 @@ public class WlyySerivceController extends BaseController{
                return write(200,"调用成功","data",jsonString);
            }
        }catch (Exception e){
            error(e);
            return error(-1,"调用失败");
        }
    }
@ -147,6 +149,7 @@ public class WlyySerivceController extends BaseController{
                return write(200,"调用成功","data",jsonString);
            }
        }catch (Exception e){
            error(e);
            return error(-1,"调用失败");
        }
    }
@ -188,6 +191,7 @@ public class WlyySerivceController extends BaseController{
                return write(200,"调用成功","data",jsonString);
            }
        }catch (Exception e){
            error(e);
            return error(-1,"调用失败");
        }
    }

+ 1 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/common/verified/VerifiedController.java

@ -1,28 +1,13 @@
package com.yihu.wlyy.web.common.verified;
import com.yihu.wlyy.service.third.verified.VerifiedService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImageCompress;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import org.apache.commons.io.FileUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import sun.misc.BASE64Encoder;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.text.SimpleDateFormat;
import java.util.*;
@Controller
@RequestMapping(value = "/verified", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ -69,6 +54,7 @@ public class VerifiedController extends BaseController {
			return write(200, "人脸识别成功!");
		} catch (Exception e) {
			error(e);
			return error(-1, e.getMessage());
		}
	}

+ 7 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/account/DoctorController.java

@ -293,6 +293,7 @@ public class DoctorController extends BaseController {
            return write(200, "查询成功", "data", hos);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -355,6 +356,7 @@ public class DoctorController extends BaseController {
            JSONArray doctors = doctorInfoService.findWorkingDoctorListByDept(dept, hospital, level, key, page, pagesize);
            return write(200, "查询成功", "data", doctors);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -1351,6 +1353,7 @@ public class DoctorController extends BaseController {
            }
            return write(200, "查询成功!", "doctors", array);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
@ -1400,6 +1403,7 @@ public class DoctorController extends BaseController {
                return error(-1, "更新失败");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "更新失败");
        }
    }
@ -1451,6 +1455,7 @@ public class DoctorController extends BaseController {
                return error(-1, "更新失败");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "更新失败");
        }
    }
@ -1609,6 +1614,7 @@ public class DoctorController extends BaseController {
                return write(-1, "手机号更新失败");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "手机号更新失败");
        }
    }
@ -1667,6 +1673,7 @@ public class DoctorController extends BaseController {
            doctorInfoService.updatePassword(newPassword1, newPassword2, oldPassword, doctorCode);
            return write(200, "更新成功");
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }

+ 38 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/application/ApplicationController.java

@ -0,0 +1,38 @@
package com.yihu.wlyy.web.doctor.application;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.service.app.application.ApplicationService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by yeshijie on 2017/11/13.
 */
@RestController
@RequestMapping(value = "/doctor/application", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "应用")
public class ApplicationController extends BaseController{
    @Autowired
    private ApplicationService applicationService;
    @RequestMapping(value = "getApplist", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("获取pcim应用列表")
    public String getApplist() {
        try {
            JSONArray re = applicationService.getAppList("1",getUID());
            return write(200, "获取成功!", "data", re);
        } catch (Exception e) {
            error(e);
            return error(-1, "获取失败");
        }
    }
}

+ 7 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/archives/DoctorArchivesController.java

@ -52,6 +52,7 @@ public class DoctorArchivesController extends BaseController {
            return write(200, "获取就诊记录成功!", "data", result);
        } catch (Exception e) {
            error(e);
            if(e.getMessage().indexOf("卡号尚未在医疗机构注册过")>0)
            {
                return error(-1,"对不起,您的社保卡有变更,请改天再试");
@ -82,6 +83,7 @@ public class DoctorArchivesController extends BaseController {
            return write(200, "获取健康档案详情成功!", "data", result);
        } catch (Exception e) {
            error(e);
            if(e.getMessage().indexOf("卡号尚未在医疗机构注册过")>0)
            {
                return error(-1,"对不起,您的社保卡有变更,请改天再试");
@ -108,6 +110,7 @@ public class DoctorArchivesController extends BaseController {
            return write(200, "通过事件号获取档案类型列表成功!", "data", result);
        } catch (Exception e) {
            error(e);
            if(e.getMessage().indexOf("卡号尚未在医疗机构注册过")>0)
            {
                return error(-1,"对不起,您的社保卡有变更,请改天再试");
@ -137,6 +140,7 @@ public class DoctorArchivesController extends BaseController {
            return write(200, "获取用药记录成功!", "data", result);
        } catch (Exception e) {
            error(e);
            if(e.getMessage().indexOf("卡号尚未在医疗机构注册过")>0)
            {
                return error(-1,"对不起,您的社保卡有变更,请改天再试");
@ -168,6 +172,7 @@ public class DoctorArchivesController extends BaseController {
            return write(200, "获取检查检验报告成功!", "data", result);
        } catch (Exception e) {
            error(e);
            if(e.getMessage().indexOf("卡号尚未在医疗机构注册过")>0)
            {
                return error(-1,"对不起,您的社保卡有变更,请改天再试");
@ -194,7 +199,7 @@ public class DoctorArchivesController extends BaseController {
            return write(200, "获取就诊事件详情成功!", "data", result);
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "获取就诊事件详情失败!");
        }
    }
@ -211,6 +216,7 @@ public class DoctorArchivesController extends BaseController {
            return write(200, "保存就诊事件成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "保存就诊事件失败!");
        }
    }

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/booking/DoctorBookingController.java

@ -59,6 +59,7 @@ public class DoctorBookingController extends BaseController{
                return error(-1, "挂号单不存在!");
            }
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -105,6 +106,7 @@ public class DoctorBookingController extends BaseController{
                return error(-1, "取消挂号单失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultMoviController.java

@ -102,7 +102,7 @@ public class DoctorConsultMoviController extends BaseController {
	/**
	 * 根据code查询电话和视频详情
	 * @param consult 咨询标识
	 * @param code 咨询标识
	 * @return
	 */
	@ApiOperation("根据code查询电话和视频详情")

+ 8 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java

@ -58,6 +58,7 @@ public class DoctorDeviceController extends BaseController {
			return success("设备保存成功!");
		}
		catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1, ex.getMessage());
		}
	}
@ -77,6 +78,7 @@ public class DoctorDeviceController extends BaseController {
			return write(200, "查询成功", "data", list);
		} catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1, ex.getMessage());
		}
	}
@ -119,6 +121,7 @@ public class DoctorDeviceController extends BaseController {
				return error(-1, "不存在该设备!");
			}
		} catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1,ex.getMessage());
		}
	}
@ -138,6 +141,7 @@ public class DoctorDeviceController extends BaseController {
			patientDeviceService.deleteDevices(deviceSn,type,getUID());
			return write(200,"解绑成功!");
		}catch (Exception e){
			error(e);
			return write(-1,e.getMessage());
		}
	}
@ -153,6 +157,7 @@ public class DoctorDeviceController extends BaseController {
			return write(200, "查询成功", "data", device);
		} catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1, ex.getMessage());
		}
	}
@ -174,6 +179,7 @@ public class DoctorDeviceController extends BaseController {
			return error(-1, re);
		}catch (Exception e){
			error(e);
			return error(-1,e.getMessage());
		}
	}
@ -188,6 +194,7 @@ public class DoctorDeviceController extends BaseController {
			String re = patientDeviceService.registerSn(deviceSn);
			return write(200,re);
		}catch (Exception e){
			error(e);
			return error(-1,e.getMessage());
		}
	}
@ -207,6 +214,7 @@ public class DoctorDeviceController extends BaseController {
			List<Map<String,String>> list = patientDeviceService.getDeviceUser(patient,deviceSn,type);
			return write(200, "获取设备绑定信息成功!", "data",list);
		} catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1, ex.getMessage());
		}
	}

+ 17 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/discussion/DoctorDiscussionGroupController.java

@ -1,19 +1,17 @@
package com.yihu.wlyy.web.doctor.discussion;
import java.util.*;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.consult.Consult;
import com.yihu.wlyy.entity.consult.ConsultTeam;
import com.yihu.wlyy.entity.discussion.WlyyTalkGroup;
import com.yihu.wlyy.entity.discussion.WlyyTalkGroupMember;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.service.app.consult.ConsultService;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
@ -27,9 +25,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import com.yihu.wlyy.service.app.talk.TalkGroupService;
import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.web.BaseController;
import java.util.*;
@Controller
@RequestMapping(value = "/doctor/talkgroup", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ -205,6 +201,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "创建讨论组失败!");
        }
    }
@ -369,6 +366,7 @@ public class DoctorDiscussionGroupController extends BaseController {
                return error(-1, "创建讨论组失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "创建讨论组失败");
        }
    }
@ -408,6 +406,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            return write(200, "查询成功", "data", group);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -494,6 +493,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            return write(200, "添加讨论组成员成功!", "data", memberJson);
        } catch (Exception e) {
            error(e);
            return error(-1, "添加讨论组成员失败!");
        }
    }
@ -572,6 +572,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            return write(200, "添加成员成功");
        } catch (Exception e) {
            error(e);
            return error(-1, "添加成员失败!");
        }
    }
@ -595,6 +596,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            talkGroupService.deleteTalkMember(groupCode, memberCode);
            return write(200, "移除成员成功!");
        } catch (Exception e) {
            error(e);
            return error(-1, "移除讨论组成员失败!");
        }
    }
@ -664,6 +666,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            return write(200, "获取医生讨论组成功!", "data", jsonArray);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "获取医生讨论组列表失败!");
        }
    }
@ -684,6 +687,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            return write(200, "查询成功", "data", new JSONArray(data));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -753,6 +757,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            }
            return write(200, "查询成功", "data", json);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }
@ -796,6 +801,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            return write(200, "获取讨论组成员列表成功!", "data", result);
        } catch (Exception ex) {
            error(ex);
            return error(-1, "获取讨论组成员列表失败!");
        }
    }
@ -814,6 +820,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            JSONArray groups = talkGroupService.getTalkGroupHistories(getUID(), patient);
            return write(200, "获取讨论组历史记录成功!", "data", groups);
        } catch (Exception e) {
            error(e);
            return error(-1, "获取讨论组历史记录失败!");
        }
    }
@ -852,6 +859,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            return write(200, "查询成功!", "data", jsonArray);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
@ -870,6 +878,7 @@ public class DoctorDiscussionGroupController extends BaseController {
            return write(200, "查询成功!", "data", count);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }

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

@ -60,6 +60,7 @@ public class DoctorFamilyController extends WeixinBaseController {
            return write(200, "查询成功", "list", result.size() > 0 ? new JSONArray(result.values()) : new JSONArray());
        } 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);

+ 2 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prenatalInspector/PrenatalController.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.web.doctor.prenatalInspector;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.prenatalInspector.PrenatalInspectorPreCardService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
@ -27,6 +28,7 @@ public class PrenatalController extends BaseController{
    @ApiOperation("建卡列表-孕检计划")
    @RequestMapping(value = "prenatalInspectorList", method = RequestMethod.POST)
    @ObserverRequired
    public String prenatalInspectorList(@ApiParam(name = "patient", value = "居民code", defaultValue = "d9de442323324a759ac82857c4692184")
                                        @RequestParam(value = "patient", required = true) String patient){
        try {

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/reply/DoctorQuickReplyController.java

@ -158,8 +158,8 @@ public class DoctorQuickReplyController extends BaseController {
    public String replyList(@ApiParam(name = "type", value = "快捷回复类型(1为续方咨询)", defaultValue = "0")
                                @RequestParam(value = "type", required = false, defaultValue = "0") String type) {
        try {
//            List<DoctorQuickReply> replies = quickReplyService.getDoctorReplyList(getUID(),type);
            List<DoctorQuickReply> replies = quickReplyService.getDoctorReplyList("xy201703150222",type);
            List<DoctorQuickReply> replies = quickReplyService.getDoctorReplyList(getUID(),type);
//            List<DoctorQuickReply> replies = quickReplyService.getDoctorReplyList("xy201703150222",type);
            return write(200, "查询成功", "data", replies);
        } catch (Exception e) {
            e.printStackTrace();

+ 5 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheduling/DoctorWorkTimeController.java

@ -15,7 +15,6 @@ import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.ResponseStatus;
/**
 * Created by lyr on 2016/08/19.
@ -45,6 +44,7 @@ public class DoctorWorkTimeController extends BaseController {
            return write(200, "查询成功!", "data", workTime);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败!");
        }
    }
@ -116,6 +116,7 @@ public class DoctorWorkTimeController extends BaseController {
                return write(-1, "保存失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "保存失败!");
        }
    }
@ -172,6 +173,7 @@ public class DoctorWorkTimeController extends BaseController {
                return error(-1, "设置失败");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, "设置失败");
        }
    }
@ -210,6 +212,7 @@ public class DoctorWorkTimeController extends BaseController {
            JSONObject result = doctorWorkTimeService.isFamousDoctorWorking(doctor);
            return write(200,result.getString("msg"),"data",result.getString("status"));
        }catch (Exception e){
            error(e);
            return error(-1,"查询失败");
        }
    }
@ -246,6 +249,7 @@ public class DoctorWorkTimeController extends BaseController {
            JSONObject json = doctorWorkTimeService.findDoctorWeekWorkTime(doctor, week);
            return write(200, "查询成功", "data", json);
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }

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

@ -32,7 +32,7 @@ import java.util.TreeMap;
 * Created by chenweida on 2017/10/13.
 */
@Controller
@RequestMapping(value = "/esstatistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = {RequestMethod.GET, RequestMethod.POST})
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE, method = {RequestMethod.GET, RequestMethod.POST})
@Api(description = "ES统计查询")
public class EsStatisticsController extends BaseController {
@ -353,7 +353,11 @@ public class EsStatisticsController extends BaseController {
            JSONObject result = new JSONObject();
            for (String idx : indexes) {
//                result.put("index_" + idx, statisticsAllService.getIndexLevelTwototal(endDate, area, level, idx));
                result.put("index_" + idx, statisticsESService.getIndexLevelTwototal(endDate, area, level, idx));
                if(!"16".equals(idx)){
                    result.put("index_" + idx, statisticsESService.getIndexLevelTwototal(endDate, area, level, idx));
                }else{
                    result.put("index_"+idx,statisticsESService.getPayPremiums(endDate,area,level));
                }
            }
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
@ -889,7 +893,7 @@ public class EsStatisticsController extends BaseController {
    }
    /**
     * 获取机构内服务排行
     * 获取机构内服务排行.
     *
     * @param startDate
     * @param endDate
@ -1666,7 +1670,7 @@ public class EsStatisticsController extends BaseController {
                                              @ApiParam(name="disease", value="疾病") @RequestParam(required = false)String disease){
        try{
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            return write(200, "查询成功", "data", statisticsService.getPrescriptionAgeHistogram(level,area,disease));
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionAgeHistogram(level,area,disease));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
@ -1784,6 +1788,7 @@ public class EsStatisticsController extends BaseController {
                                      @ApiParam(name="area", value="界别编码") @RequestParam(required = true)String area,
                                      @ApiParam(name="disease", value="疾病") @RequestParam(required = false)String disease){
        try{
            level = elasticsearchUtil.changeLevel(Integer.parseInt(level))+"";
            return write(200, "查询成功", "data", statisticsESService.getPrescriptionCost(level,area,disease));
        } catch (Exception e) {
            error(e);

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

@ -29,7 +29,7 @@ import java.util.*;
 * Created by lyr on 2016/08/16.
 */
@Controller
@RequestMapping(value = "/statistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@RequestMapping(value = "/oldstatistics", produces = MediaType.APPLICATION_JSON_UTF8_VALUE,method = {RequestMethod.GET,RequestMethod.POST})
@Api(description = "统计")
public class StatisticsController extends BaseController {

+ 17 - 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;
@ -17,6 +19,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import java.util.*;
/**
@ -288,4 +291,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(){
    }
    /**
     * 获取要推送的患者

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

@ -156,6 +156,7 @@ public class BookingController extends WeixinBaseController {
            return re;
//            return write(200, "获取机构列表成功!", "data", re);
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -180,6 +181,7 @@ public class BookingController extends WeixinBaseController {
            return list;
//            return write(200, "获取科室列表成功!", "data", list);
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -207,6 +209,7 @@ public class BookingController extends WeixinBaseController {
            String list  = jwSmjkService.getRegDeptSpeDoctorList(hospitalId,hosDeptId);
            return list;
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -227,6 +230,7 @@ public class BookingController extends WeixinBaseController {
            String list = jwSmjkService.GetDoctorArrange(hospitalId,hosDeptId,doctorId);
            return list;
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -247,6 +251,7 @@ public class BookingController extends WeixinBaseController {
            String list = jwSmjkService.GetDoctorArrangeSimple(hospitalId,hosDeptId,doctorId);
            return list;
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -270,6 +275,7 @@ public class BookingController extends WeixinBaseController {
            JSONObject result  = jwSmjkService.GetDoctorInfoTen(hospitalId,hosDeptId,doctorId);
            return write(200, "获取医生详细信息成功!","data",result);
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -392,6 +398,7 @@ public class BookingController extends WeixinBaseController {
                return error(-1, "创建挂号单失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -471,6 +478,7 @@ public class BookingController extends WeixinBaseController {
                return error(-1, "取消挂号单失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -648,6 +656,7 @@ public class BookingController extends WeixinBaseController {
                return error(-1, "创建挂号单失败!");
            }
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -666,6 +675,7 @@ public class BookingController extends WeixinBaseController {
            List<Map<String, Object>> list = guahaoXM.GetDoctorArrangeTenDay(hospitalId, hosDeptId, doctorId);
            return write(200, "获取医生排班成功!", "data", list);
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -687,6 +697,7 @@ public class BookingController extends WeixinBaseController {
            return write(200, "获取患者预约信息列表成功!", "data", list);
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -706,6 +717,7 @@ public class BookingController extends WeixinBaseController {
            return write(200, "获取患者预约信息列表成功!", "data", list);
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -722,6 +734,7 @@ public class BookingController extends WeixinBaseController {
            return write(200, "获取患者预约信息成功!", "data", obj);
        }
        catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -737,6 +750,7 @@ public class BookingController extends WeixinBaseController {
            Long obj = patientReservationService.countReservationByDoctorForPatient(doctor, patient);
            return write(200, "获取患者预约信息成功!", "data", obj);
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -755,6 +769,7 @@ public class BookingController extends WeixinBaseController {
            String list = jwSmjkService.GetRegList(patient);
            return list;
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }
@ -773,6 +788,7 @@ public class BookingController extends WeixinBaseController {
            String obj = jwSmjkService.GetRegDetail(patientCode,orgCode,regCode);
            return obj;
        } catch (Exception e) {
            error(e);
            return error(-1, e.getMessage());
        }
    }

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

@ -17,6 +17,7 @@ import com.yihu.wlyy.service.third.ylz.PayLogService;
import com.yihu.wlyy.service.weixin.wxpay.model.BindCard;
import com.yihu.wlyy.service.weixin.wxpay.model.Charge;
import com.yihu.wlyy.service.weixin.wxpay.service.OnePayService;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.web.WeixinBaseController;
import com.ylzinfo.onepay.sdk.OnepayDefaultClient;
import com.ylzinfo.onepay.sdk.domain.RequestParams;
@ -28,11 +29,14 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
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.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
@ -51,10 +55,7 @@ import java.io.StringWriter;
import java.net.URLDecoder;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * Created by hzp on 2017/05/23.
@ -84,6 +85,12 @@ public class OnePayController extends WeixinBaseController {
    ObjectMapper objectMapper;
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Value("${doctorAssistant.api}")
    private String doctorAssistant;
    @Value("${doctorAssistant.target_url}")
    private String targetUrl;
    @Autowired
    private HttpClientUtil httpClientUtil;
    @RequestMapping(value = "bindCard", method = RequestMethod.POST)
    @ApiOperation("查询绑卡信息")
@ -758,12 +765,29 @@ public class OnePayController extends WeixinBaseController {
    @ResponseBody
    public String cleaData() throws IOException, PayException {
        try {
            String sql = "SELECT t.code FROM wlyy_charge t WHERE (t.need_upload != '0' OR t.need_upload is null) AND (t.trade_status = '0' OR t.trade_status = '1')";
            /*String sql = "SELECT t.code FROM wlyy_charge t WHERE (t.need_upload != '0' OR t.need_upload is null) AND (t.trade_status = '0' OR t.trade_status = '1')";
            List<Map<String, Object>> codes = jdbcTemplate.queryForList(sql);
            for (Map<String, Object> code :codes) {
                String outChargeNo = code.get("code").toString();
                pay.chargeQuery(outChargeNo,getAccessToken());
            }
            }*/
            String url = doctorAssistant + "/wllyy/feldsher/sendDoctorTemplates";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("type", "5"));
            params.add(new BasicNameValuePair("openId", "orrOgwATDaljVunlAq_Tdx3imhYg"));
            params.add(new BasicNameValuePair("url", targetUrl));
            params.add(new BasicNameValuePair("first", "wjj" + "医生您好,你有一条新的签约申请待处理"));
            params.add(new BasicNameValuePair("remark", "请尽快使用厦门i健康APP处理居民的签约申请"));
            SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
            String date = format.format(new Date());
            String keywords = date + "," + "wjj";
            params.add(new BasicNameValuePair("keywords", keywords));
            LOGGER.info("==========================================");
            LOGGER.info("url ==>"+url);
            LOGGER.info("targetUrl ==>"+targetUrl);
            LOGGER.info("==========================================");
            httpClientUtil.post(url, params, "UTF-8");
            LOGGER.info("*********************************************");
            return write(200, "数据整理成功!");
        } catch (Exception e) {
            return write(-1, "数据整理成功失败!");

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

@ -106,9 +106,8 @@ es:
    HealthEduArticlePatient: health_edu_article_patient_dev
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl
#消息队列
activemq:

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

@ -104,9 +104,8 @@ es:
    HealthEduArticlePatient: health_edu_article_patient_test
    FollowUpContent: wlyy_followup_content
    Statistics: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

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

@ -102,9 +102,8 @@ es:
    HealthEduArticlePatient: health_edu_article_patient_test
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  host:  http://59.61.92.90:9065,http://59.61.92.90:9067
  tHost: 59.61.92.90:9066,59.61.92.90:9068
  clusterName: jkzl
#消息队列

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

@ -103,9 +103,8 @@ es:
    HealthEduArticlePatient: health_edu_article_patient_test
    Statistics: wlyy_quota_test
    FollowUpContent: wlyy_followup_content
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl

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

@ -104,9 +104,8 @@ es:
    HealthEduArticlePatient: health_edu_article_patient_prod
    Statistics: wlyy_quota_prod
    FollowUpContent: wlyy_followup_content
  host: 59.61.92.90
  port: 9065
  tPort: 9066
  host:  http://59.61.92.90:9065,http://59.61.92.90:9067
  tHost: 59.61.92.90:9066,59.61.92.90:9068
  clusterName: jkzl
#消息队列

+ 0 - 0
patient-co/patient-co-wlyy/src/main/resources/application-test.yml


Some files were not shown because too many files changed in this diff