Ver código fonte

Merge branch 'dev' of http://192.168.1.220:10080/jiwei/wlyy2.0 into dev

yeshijie 6 anos atrás
pai
commit
45f1989f2e
100 arquivos alterados com 5418 adições e 1270 exclusões
  1. 50 0
      common/common-entity-es/pom.xml
  2. 1 1
      common/common-entity/src/main/java/com/yihu/jw/iot/datainput/Data.java
  3. 14 4
      common/common-entity/src/main/java/com/yihu/jw/iot/datainput/DataBodySignsDO.java
  4. 1 2
      common/common-entity/src/main/java/com/yihu/jw/iot/datainput/StepInfoDO.java
  5. 1 1
      common/common-entity/src/main/java/com/yihu/jw/iot/datainput/WeRunDataDO.java
  6. 1 1
      common/common-entity/src/main/java/com/yihu/jw/iot/device/LocationDataDO.java
  7. 0 20
      common/common-entity/pom.xml
  8. 131 9
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/AccountDO.java
  9. 135 0
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActiveRecordDO.java
  10. 205 35
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActivityDO.java
  11. 0 48
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActivityRuleDO.java
  12. 90 11
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/CreditsDetailDO.java
  13. 112 33
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskDO.java
  14. 0 93
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskDetailDO.java
  15. 64 0
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskDictDO.java
  16. 75 0
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskGoodsDO.java
  17. 160 0
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskPatientDetailDO.java
  18. 75 0
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskRangDO.java
  19. 79 12
      common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskRuleDO.java
  20. 39 21
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientHospitalRecordDO.java
  21. 94 87
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java
  22. 83 77
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java
  23. 83 77
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistArticleDO.java
  24. 126 117
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistConsultDO.java
  25. 116 108
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistDO.java
  26. 61 22
      common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistPatientRelationDO.java
  27. 10 0
      common/common-entity/src/main/java/com/yihu/jw/rehabilitation/RehabilitationPlanningDO.java
  28. 3 3
      common/common-entity/src/main/java/com/yihu/jw/rehabilitation/RehabilitationTreatmentProgramDO.java
  29. 25 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/bank/HealthBankMapping.java
  30. 1 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/rehabilitation/RehabilitationRequestMapping.java
  31. 28 0
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/specialist/SpecialistMapping.java
  32. 0 23
      common/common-rest-model-es/src/main/java/common/SaveModel.java
  33. 13 2
      common/common-rest-model-es/src/main/java/iot/device/LocationDataVO.java
  34. 13 0
      common/common-rest-model/pom.xml
  35. 1 2
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/EnvelopRestController.java
  36. 10 3
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/rehabilitation/RehabilitationPlanningVO.java
  37. 3 3
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/rehabilitation/RehabilitationTreatmentProgramVO.java
  38. 34 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/AdminTeamMemberVO.java
  39. 44 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/AssistantVO.java
  40. 130 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientLabelVO.java
  41. 30 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientRelationVO.java
  42. 198 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientSignInfoVO.java
  43. 148 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SpecialistTeamVO.java
  44. 362 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SurveyScreenResultVo.java
  45. 85 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SurveyTemplateQuestionsVo.java
  46. 42 0
      common/common-util/src/main/java/com/yihu/jw/util/common/IdCardUtil.java
  47. 10 12
      svr-lib-parent-pom/pom.xml
  48. 2 1
      svr/readme.MD
  49. 6 3
      svr/svr-base/src/main/java/com/yihu/jw/business/demo/DemoController.java
  50. 0 69
      svr/svr-base/src/main/java/com/yihu/jw/business/sms/controller/SMSController.java
  51. 10 4
      svr/svr-base/src/main/java/com/yihu/jw/config/jpa/HibernateProperties.java
  52. 7 1
      svr/svr-base/src/main/resources/application.yml
  53. 6 1
      svr/svr-iot/pom.xml
  54. 5 7
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java
  55. 1 4
      svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataStandardConvertService.java
  56. 2 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/common/ElasticSearchQueryGenerator.java
  57. 12 16
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java
  58. 1 0
      svr/svr-iot/src/main/resources/application.yml
  59. 1 0
      svr/svr-rehabilitation/readme.MD
  60. 3 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationInformationController.java
  61. 18 3
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationPerformanceController.java
  62. 5 5
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationPlanningController.java
  63. 4 4
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationTreatmentProgramController.java
  64. 3 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationInformationDao.java
  65. 5 0
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationPerformanceDao.java
  66. 1 1
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationPlanningDao.java
  67. 5 5
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationInformationService.java
  68. 10 0
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPerformanceService.java
  69. 6 5
      svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPlanningService.java
  70. 6 0
      svr/svr-wlyy-health-bank/pom.xml
  71. 3 0
      svr/svr-wlyy-health-bank/src/main/java/META-INF/MANIFEST.MF
  72. 9 3
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/config/jpa/HibernateProperties.java
  73. 57 4
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/AccountController.java
  74. 57 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/ActiveRecordController.java
  75. 64 1
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/ActivityController.java
  76. 0 95
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/ActivityDetailController.java
  77. 125 2
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/CreditsDetailController.java
  78. 77 6
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskController.java
  79. 5 5
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskDetailController.java
  80. 100 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskDictController.java
  81. 102 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskGoodsController.java
  82. 56 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskPatientDetailController.java
  83. 102 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskRangController.java
  84. 135 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskRuleController.java
  85. 16 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/ActiveRecordDao.java
  86. 0 11
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/ActivityRuleDao.java
  87. 8 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskDao.java
  88. 0 11
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskDetailDao.java
  89. 15 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskDictDao.java
  90. 15 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskGoodsDao.java
  91. 19 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskPatientDetailDao.java
  92. 15 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskRangDao.java
  93. 331 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/AccountService.java
  94. 88 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActiveRecordService.java
  95. 0 109
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityRuleService.java
  96. 171 2
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityService.java
  97. 642 46
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java
  98. 15 15
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/TaskDetailService.java
  99. 86 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/TaskDictService.java
  100. 0 0
      svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/TaskGoodsService.java

+ 50 - 0
common/common-entity-es/pom.xml

@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.yihu.base</groupId>
        <artifactId>common-lib-parent-pom</artifactId>
        <version>1.0.0</version>
        <relativePath>../../common-lib-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.jw</groupId>
    <artifactId>common-entity-es</artifactId>
    <version>${parent.version}</version>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-commons</artifactId>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
            <version>2.1.3.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>io.searchbox</groupId>
            <artifactId>jest-common</artifactId>
            <version>2.4.0</version>
        </dependency>
    </dependencies>
</project>

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/iot/datainput/Data.java

@ -1,4 +1,4 @@
package com.yihu.jw.iot.datainput;
package com.yihu.jw.datainput;
/**
 * 具体各项体征指标数据值
 * @author lith on 2018/01/17.

+ 14 - 4
common/common-entity/src/main/java/com/yihu/jw/iot/datainput/DataBodySignsDO.java

@ -1,6 +1,7 @@
package com.yihu.jw.iot.datainput;
package com.yihu.jw.datainput;
import com.yihu.base.es.config.model.SaveModel;
import io.searchbox.annotations.JestId;
import java.util.List;
@ -8,9 +9,10 @@ import java.util.List;
 * 体征数据实体类,新的标准的数据格式
 * @author lith on 2018/01/17.
 */
public class DataBodySignsDO extends SaveModel {
public class DataBodySignsDO {
    @JestId
    private String id;
    private String access_token; //访问token
    private String data_source; //数据来源
    private String sn;          //设备序列码
@ -22,6 +24,14 @@ public class DataBodySignsDO extends SaveModel {
    private String username;    //用户名
    private String usercode;    //用户在系统中的code,唯一识别
    public String getId() {
        return this.id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getAccess_token() {
        return access_token;
    }

+ 1 - 2
common/common-entity/src/main/java/com/yihu/jw/iot/datainput/StepInfoDO.java

@ -1,6 +1,5 @@
package com.yihu.jw.iot.datainput;
package com.yihu.jw.datainput;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
 * 微信运动具体时间步数实体类
 * @author lith on 2018/01/17.

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/iot/datainput/WeRunDataDO.java

@ -1,4 +1,4 @@
package com.yihu.jw.iot.datainput;
package com.yihu.jw.datainput;
import java.util.List;

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/iot/device/LocationDataDO.java

@ -1,4 +1,4 @@
package com.yihu.jw.iot.device;
package com.yihu.jw.device;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;

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

@ -36,25 +36,5 @@
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-annotations</artifactId>
        </dependency>
        <dependency>
            <groupId>io.searchbox</groupId>
            <artifactId>jest-common</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>io.searchbox</groupId>
            <artifactId>jest-common</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-elasticsearch</artifactId>
            <version>2.1.9.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <artifactId>common-data-es</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
</project>

+ 131 - 9
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/AccountDO.java

@ -7,6 +7,7 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.List;
/**
 * Created by wang zhinan on 2018/4/26.
@ -25,7 +26,7 @@ public class AccountDO extends IdEntityWithOperation implements Serializable {
    private String accountName;//账户名
    @Column(name = "total")
    private int total;//积分总数
    private Integer total;//积分总数
    @Column(name = "password")
    private String password;//密码
@ -39,11 +40,44 @@ public class AccountDO extends IdEntityWithOperation implements Serializable {
    @Column(name = "hospital")
    private String hospital;//社区
    @Column(name = "status")
    private Integer status;//状态(1有效,-1失效)
    @Transient
    private String idCard;//身份证号码
    @Transient
    private Long sum;//总积分(已用积分和剩余积分)
    @Transient
    private Integer usedTotal;//已用积分
    @Transient
    private Long nowTotal;//今日获取积分
    @Transient
    private Long activityTotal;//参与活动数;
    @Transient
    private Long taskTotal;//参与任务数;
    @Transient
    private Integer teamRanking;//团队排名
    @Transient
    private Integer cityRanking;//全市排名
    @Transient
    private String sum;//总积分(已用积分和剩余积分)
    private List<String> patientIds;//团队居民id
    @Transient
    private int usedTotal;//已用积分
    private String taskId;//任务id
    @Transient
    private Long activityRanking;//活动排名
    @Transient
    private Long activityIntegrate;//活动积分
    public String getSaasId() {
        return saasId;
@ -69,11 +103,11 @@ public class AccountDO extends IdEntityWithOperation implements Serializable {
        this.accountName = accountName;
    }
    public int getTotal() {
    public Integer getTotal() {
        return total;
    }
    public void setTotal(int total) {
    public void setTotal(Integer total) {
        this.total = total;
    }
@ -85,11 +119,11 @@ public class AccountDO extends IdEntityWithOperation implements Serializable {
        this.hospital = hospital;
    }
    public int getUsedTotal() {
    public Integer getUsedTotal() {
        return usedTotal;
    }
    public void setUsedTotal(int usedTotal) {
    public void setUsedTotal(Integer usedTotal) {
        this.usedTotal = usedTotal;
    }
@ -117,11 +151,99 @@ public class AccountDO extends IdEntityWithOperation implements Serializable {
        this.hospitalName = hospitalName;
    }
    public String getSum() {
    public Long getSum() {
        return sum;
    }
    public void setSum(String sum) {
    public void setSum(Long sum) {
        this.sum = sum;
    }
    public Long getNowTotal() {
        return nowTotal;
    }
    public void setNowTotal(Long nowTotal) {
        this.nowTotal = nowTotal;
    }
    public Long getActivityTotal() {
        return activityTotal;
    }
    public void setActivityTotal(Long activityTotal) {
        this.activityTotal = activityTotal;
    }
    public Long getTaskTotal() {
        return taskTotal;
    }
    public void setTaskTotal(Long taskTotal) {
        this.taskTotal = taskTotal;
    }
    public Integer getTeamRanking() {
        return teamRanking;
    }
    public void setTeamRanking(Integer teamRanking) {
        this.teamRanking = teamRanking;
    }
    public Integer getCityRanking() {
        return cityRanking;
    }
    public void setCityRanking(Integer cityRanking) {
        this.cityRanking = cityRanking;
    }
    public List<String> getPatientIds() {
        return patientIds;
    }
    public void setPatientIds(List<String> patientIds) {
        this.patientIds = patientIds;
    }
    public String getTaskId() {
        return taskId;
    }
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
    public Long getActivityRanking() {
        return activityRanking;
    }
    public void setActivityRanking(Long activityRanking) {
        this.activityRanking = activityRanking;
    }
    public Long getActivityIntegrate() {
        return activityIntegrate;
    }
    public void setActivityIntegrate(Long activityIntegrate) {
        this.activityIntegrate = activityIntegrate;
    }
    public String getIdCard() {
        return idCard;
    }
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 135 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActiveRecordDO.java

@ -0,0 +1,135 @@
package com.yihu.jw.entity.health.bank;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.IdEntity;
import com.yihu.jw.IdEntityWithOperation;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by 刘文彬 on 2018/6/12.
 */
@Entity
@Table(name = "wlyy_health_bank_active_record")
@EntityListeners(AuditingEntityListener.class)
public class ActiveRecordDO extends IdEntity implements Serializable {
    private String saasId; //saasId
    private String taskId;  //wlyy_health_bank_task任务表的id
    private String taskTitle;//任务标题
    private String activityId;//wlyy_health_bank_activity表的id
    private String activityTitle;//活动标题
    private Integer originalStatus;//原先状态
    private Integer currentStatus;//当前状态
    private String patientId;//居民code
    private String patientName;//居民名称
    private Integer teamId;//wlyy_admin_team医生行政团队的id
    private Date createTime;
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "task_id")
    public String getTaskId() {
        return taskId;
    }
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
    @Column(name = "task_title")
    public String getTaskTitle() {
        return taskTitle;
    }
    public void setTaskTitle(String taskTitle) {
        this.taskTitle = taskTitle;
    }
    @Column(name = "activity_id")
    public String getActivityId() {
        return activityId;
    }
    public void setActivityId(String activityId) {
        this.activityId = activityId;
    }
    @Column(name = "activity_title")
    public String getActivityTitle() {
        return activityTitle;
    }
    public void setActivityTitle(String activityTitle) {
        this.activityTitle = activityTitle;
    }
    @Column(name = "original_status")
    public Integer getOriginalStatus() {
        return originalStatus;
    }
    public void setOriginalStatus(Integer originalStatus) {
        this.originalStatus = originalStatus;
    }
    @Column(name = "current_status")
    public Integer getCurrentStatus() {
        return currentStatus;
    }
    public void setCurrentStatus(Integer currentStatus) {
        this.currentStatus = currentStatus;
    }
    @Column(name = "patient_id")
    public String getPatientId() {
        return patientId;
    }
    public void setPatientId(String patientId) {
        this.patientId = patientId;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "team_id")
    public Integer getTeamId() {
        return teamId;
    }
    public void setTeamId(Integer teamId) {
        this.teamId = teamId;
    }
    @CreatedDate
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @Column(name = "create_time", nullable = false, length = 0,updatable = false)
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 205 - 35
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActivityDO.java

@ -6,8 +6,10 @@ import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * Created by wang zhinan on 2018/4/26.
@ -19,28 +21,73 @@ public class ActivityDO extends IdEntityWithOperation implements Serializable {
    @Column(name = "saas_id")
    private String saasId;//saasId
    @Column(name = "activity_title")
    private String activityTitle;//活动标题
    @Column(name = "organizer")
    private String organizer; // 主办方&&发布机构
    @Column(name = "title")
    private String title;//活动标题
    @Column(name = "description")
    private String description;//活动说明
    @Column(name = "activity_content")
    private String activityContent;//活动内容
    @Column(name = "location")
    private String location;//活动地点
    @Column(name = "img")
    private String img;//活动图片
    @Column(name = "start_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date startTime;//开始时间
    @Column(name = "over_time")
    @Column(name = "end_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date overTime; //结束时间
    private Date endTime; //结束时间
    @Column(name = "status")
    private int status;//状态(上架/下架)
    private Integer status;//状态(1代表有效,0代表无效,-1代表过期)
    @Column(name = "hospital")
    private String hospital;//社区
    @Column(name = "is_flag")
    private Integer isFlag;//标识是否有问卷(1:有,-1:没有)
    @Column(name = "organizer")
    private String organizer;//发布者
    @Column(name = "area")
    private String area;//区域
    @Column(name = "area_type")
    private Integer areaType; //区域类型
    @Column(name = "remark")
    private String remark;//活动备注
    @Column(name = "type")
    private String type;//活动类型
    @Transient
    private String patientId;//居民id
    @Transient
    private String openId;//微信编码
    @Transient
    private String unionId;
    @Transient
    private String patientIdcard;//身份证号
    @Transient
    private Long total;//参加总数
    @Transient
    private Integer activityRanking;//活动中的排名
    @Transient
    private List<TaskPatientDetailDO> taskPatientDetailDOS;//参与活动详情
    @Transient
    private List<TaskDO> taskDOS;//活动任务列表
    @Transient
    private Long sum;//活动积分总数
    public String getSaasId() {
        return saasId;
@ -50,20 +97,44 @@ public class ActivityDO extends IdEntityWithOperation implements Serializable {
        this.saasId = saasId;
    }
    public String getActivityTitle() {
        return activityTitle;
    public String getOrganizer() {
        return organizer;
    }
    public void setOrganizer(String organizer) {
        this.organizer = organizer;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getDescription() {
        return description;
    }
    public void setActivityTitle(String activityTitle) {
        this.activityTitle = activityTitle;
    public void setDescription(String description) {
        this.description = description;
    }
    public String getActivityContent() {
        return activityContent;
    public String getLocation() {
        return location;
    }
    public void setActivityContent(String activityContent) {
        this.activityContent = activityContent;
    public void setLocation(String location) {
        this.location = location;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    public Date getStartTime() {
@ -74,35 +145,134 @@ public class ActivityDO extends IdEntityWithOperation implements Serializable {
        this.startTime = startTime;
    }
    public Date getOverTime() {
        return overTime;
    public Integer getStatus() {
        return status;
    }
    public void setOverTime(Date overTime) {
        this.overTime = overTime;
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getOrganizer() {
        return organizer;
    public Integer getIsFlag() {
        return isFlag;
    }
    public void setOrganizer(String organizer) {
        this.organizer = organizer;
    public void setIsFlag(Integer isFlag) {
        this.isFlag = isFlag;
    }
    public int getStatus() {
        return status;
    public String getRemark() {
        return remark;
    }
    public void setStatus(int status) {
        this.status = status;
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public String getArea() {
        return area;
    }
    public void setArea(String area) {
        this.area = area;
    }
    public Integer getAreaType() {
        return areaType;
    }
    public void setAreaType(Integer areaType) {
        this.areaType = areaType;
    }
    public String getOpenId() {
        return openId;
    }
    public void setOpenId(String openId) {
        this.openId = openId;
    }
    public String getPatientId() {
        return patientId;
    }
    public void setPatientId(String patientId) {
        this.patientId = patientId;
    }
    public Long getTotal() {
        return total;
    }
    public void setTotal(Long total) {
        this.total = total;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public List<TaskPatientDetailDO> getTaskPatientDetailDOS() {
        return taskPatientDetailDOS;
    }
    public void setTaskPatientDetailDOS(List<TaskPatientDetailDO> taskPatientDetailDOS) {
        this.taskPatientDetailDOS = taskPatientDetailDOS;
    }
    public String getUnionId() {
        return unionId;
    }
    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }
    public String getPatientIdcard() {
        return patientIdcard;
    }
    public void setPatientIdcard(String patientIdcard) {
        this.patientIdcard = patientIdcard;
    }
    public Integer getActivityRanking() {
        return activityRanking;
    }
    public void setActivityRanking(Integer activityRanking) {
        this.activityRanking = activityRanking;
    }
    public Long getSum() {
        return sum;
    }
    public void setSum(Long sum) {
        this.sum = sum;
    }
    public String getHospital() {
        return hospital;
    public List<TaskDO> getTaskDOS() {
        return taskDOS;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    public void setTaskDOS(List<TaskDO> taskDOS) {
        this.taskDOS = taskDOS;
    }
}

+ 0 - 48
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/ActivityRuleDO.java

@ -1,48 +0,0 @@
package com.yihu.jw.entity.health.bank;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * Created by wang zhinan on 2018/4/27.
 */
@Entity
@Table(name = "wlyy_health_bank_activity_rule")
public class ActivityRuleDO extends IdEntityWithOperation implements Serializable {
    @Column(name = "saas_id")
    private String saasId;//saasid
    @Column(name = "activity_id")
    private String activityId;//活动id
    @Column(name = "rule_code")
    private String ruleCode;//规则代码
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getActivityId() {
        return activityId;
    }
    public void setActivityId(String activityId) {
        this.activityId = activityId;
    }
    public String getRuleCode() {
        return ruleCode;
    }
    public void setRuleCode(String ruleCode) {
        this.ruleCode = ruleCode;
    }
}

+ 90 - 11
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/CreditsDetailDO.java

@ -19,19 +19,19 @@ public class CreditsDetailDO extends IdEntityWithOperation implements Serializab
    private String saasId; //saasid
    @Column(name = "trade_type")
    private String tradeType; //交易类型
    private String tradeType; //交易类型交易类型:普通任务(NORMAL_TASK)、活动任务(ACTIVITY_TASK)、兑换商品(EXCHANGE_GOODS)
    @Column(name = "transaction_id")
    private String transactionId;//业务ID
    @Column(name="integrate")
    private int integrate;//积分
    private Integer integrate;//积分
    @Column(name = "status")
    private int status;//状态(有效/无效)
    private Integer status;//状态(有效/无效)
    @Column(name = "trade_direction")
    private int tradeDirection;//交易方向
    private Integer tradeDirection;//交易方向
    @Column(name = "account_id")
    private String accountId;//账户id
@ -40,11 +40,20 @@ public class CreditsDetailDO extends IdEntityWithOperation implements Serializab
    private String patientId;//居民id
    @Column(name = "hospital")
    private String hospital;//社区
    private String hospital;//社区编码
    @Column(name = "hospital_name")
    private String hospitalName;//社区名称
    @Column(name = "description")
    private String description;//积分获取说明
    @Transient
    private TaskDO taskDO;//任务对象
    @Transient
    private String activityId;//活动ID
    @Transient
    private ActivityDO activityDO;//活动对象
@ -57,6 +66,20 @@ public class CreditsDetailDO extends IdEntityWithOperation implements Serializab
    @Transient
    private String name; //居民名称
    @Transient
    private String idCard; //身份证号码
    @Transient
    private String openId;//微信编号
    @Transient
    private Long stepNumber;//步数
    @Transient
    private String unionId;
    public String getSaasId() {
        return saasId;
    }
@ -65,19 +88,19 @@ public class CreditsDetailDO extends IdEntityWithOperation implements Serializab
        this.saasId = saasId;
    }
    public int getIntegrate() {
    public Integer getIntegrate() {
        return integrate;
    }
    public void setIntegrate(int integrate) {
    public void setIntegrate(Integer integrate) {
        this.integrate = integrate;
    }
    public int getStatus() {
    public Integer getStatus() {
        return status;
    }
    public void setStatus(int status) {
    public void setStatus(Integer status) {
        this.status = status;
    }
@ -105,11 +128,11 @@ public class CreditsDetailDO extends IdEntityWithOperation implements Serializab
        this.hospital = hospital;
    }
    public int getTradeDirection() {
    public Integer getTradeDirection() {
        return tradeDirection;
    }
    public void setTradeDirection(int tradeDirection) {
    public void setTradeDirection(Integer tradeDirection) {
        this.tradeDirection = tradeDirection;
    }
@ -168,4 +191,60 @@ public class CreditsDetailDO extends IdEntityWithOperation implements Serializab
    public void setName(String name) {
        this.name = name;
    }
    public String getIdCard() {
        return idCard;
    }
    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }
    public String getOpenId() {
        return openId;
    }
    public void setOpenId(String openId) {
        this.openId = openId;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public Long getStepNumber() {
        return stepNumber;
    }
    public void setStepNumber(Long stepNumber) {
        this.stepNumber = stepNumber;
    }
    public String getActivityId() {
        return activityId;
    }
    public void setActivityId(String activityId) {
        this.activityId = activityId;
    }
    public String getUnionId() {
        return unionId;
    }
    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
}

+ 112 - 33
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskDO.java

@ -1,5 +1,6 @@
package com.yihu.jw.entity.health.bank;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
@ -7,6 +8,8 @@ import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * Created by wamg zhinan 2018/4/27.
@ -18,29 +21,48 @@ public class TaskDO extends IdEntityWithOperation implements Serializable{
    @Column(name = "saas_id")
    private String saasId; //saasid
    @Column(name = "task_title")
    private String taskTitle; //任务标题
    @Column(name = "title")
    private String title; //任务标题
    @Column(name = "task_content")
    private String taskContent; //任务内容
    @Column(name = "content")
    private String content; //任务内容
    @Column(name = "trade_type")
    private String tradeType; //交易类型
    @Column(name = "type")
    private String type; //交易类型
    @Column(name = "transaction_id")
    private String transactionId; // 业务id
    @Column(name = "period")
    private int period; //周期性
    @Column(name = "patient_id")
    private String patientId; //居民id
    private Integer period; //周期性
    @Column(name = "task_code")
    private String taskCode ; // 标识是什么任务
    @Column(name = "status")
    private Integer status; //状态
    @Column(name = "rule_code")
    private String ruleCode;//规则code
    @Column(name = "start_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date startTime;//开始时间
    @Column(name = "end_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date endTime; //结束时间
    @Transient
    private ActivityDO activityDO;//活动详情
    @Transient
    private String patientId;//居民id
    @Transient
    private int status; //状态
    private String openId;//微信编码
    @Transient
    private Long total;//参加总数
    @Transient
    private List<TaskPatientDetailDO> taskPatientDetailDOS;//参与人详情
    public String getSaasId() {
        return saasId;
@ -50,28 +72,28 @@ public class TaskDO extends IdEntityWithOperation implements Serializable{
        this.saasId = saasId;
    }
    public String getTaskTitle() {
        return taskTitle;
    public String getTitle() {
        return title;
    }
    public void setTaskTitle(String taskTitle) {
        this.taskTitle = taskTitle;
    public void setTitle(String title) {
        this.title = title;
    }
    public String getTaskContent() {
        return taskContent;
    public String getContent() {
        return content;
    }
    public void setTaskContent(String taskContent) {
        this.taskContent = taskContent;
    public void setContent(String content) {
        this.content = content;
    }
    public String getTradeType() {
        return tradeType;
    public String getType() {
        return type;
    }
    public void setTradeType(String tradeType) {
        this.tradeType = tradeType;
    public void setType(String type) {
        this.type = type;
    }
    public String getTransactionId() {
@ -82,14 +104,62 @@ public class TaskDO extends IdEntityWithOperation implements Serializable{
        this.transactionId = transactionId;
    }
    public int getPeriod() {
    public Integer getPeriod() {
        return period;
    }
    public void setPeriod(int period) {
    public void setPeriod(Integer period) {
        this.period = period;
    }
    public String getTaskCode() {
        return taskCode;
    }
    public void setTaskCode(String taskCode) {
        this.taskCode = taskCode;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getRuleCode() {
        return ruleCode;
    }
    public void setRuleCode(String ruleCode) {
        this.ruleCode = ruleCode;
    }
    public Date getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public ActivityDO getActivityDO() {
        return activityDO;
    }
    public void setActivityDO(ActivityDO activityDO) {
        this.activityDO = activityDO;
    }
    public String getPatientId() {
        return patientId;
    }
@ -98,19 +168,28 @@ public class TaskDO extends IdEntityWithOperation implements Serializable{
        this.patientId = patientId;
    }
    public int getStatus() {
        return status;
    public List<TaskPatientDetailDO> getTaskPatientDetailDOS() {
        return taskPatientDetailDOS;
    }
    public void setStatus(int status) {
        this.status = status;
    public void setTaskPatientDetailDOS(List<TaskPatientDetailDO> taskPatientDetailDOS) {
        this.taskPatientDetailDOS = taskPatientDetailDOS;
    }
    public String getTaskCode() {
        return taskCode;
    public Long getTotal() {
        return total;
    }
    public void setTaskCode(String taskCode) {
        this.taskCode = taskCode;
    public void setTotal(Long total) {
        this.total = total;
    }
    public String getOpenId() {
        return openId;
    }
    public void setOpenId(String openId) {
        this.openId = openId;
    }
}

+ 0 - 93
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskDetailDO.java

@ -1,93 +0,0 @@
package com.yihu.jw.entity.health.bank;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * Created by wamg zhinan 2018/4/27.
 */
@Entity
@Table(name = "wlyy_health_bank_task_detail")
public class TaskDetailDO extends IdEntityWithOperation implements Serializable{
    @Column(name = "saas_id")
    private String saasId; //saasid
    @Column(name = "status")
    private String status;//状态(完成/未完成)
    @Column(name = "patient_id")
    private String patientId;//居民id
    @Column(name = "doctor_id")
    private String doctorId;//医生id
    @Column(name = "integrate")
    private int integrate;//积分
    @Column(name = "trade_direction")
    private int tradeDirection;//交易方向
    @Column(name = "task_id")
    private String taskId;//任务id
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getPatientId() {
        return patientId;
    }
    public void setPatientId(String patientId) {
        this.patientId = patientId;
    }
    public String getDoctorId() {
        return doctorId;
    }
    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    }
    public int getIntegrate() {
        return integrate;
    }
    public void setIntegrate(int integrate) {
        this.integrate = integrate;
    }
    public int getTradeDirection() {
        return tradeDirection;
    }
    public void setTradeDirection(int tradeDirection) {
        this.tradeDirection = tradeDirection;
    }
    public String getTaskId() {
        return taskId;
    }
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
}

+ 64 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskDictDO.java

@ -0,0 +1,64 @@
package com.yihu.jw.entity.health.bank;/**
 * Created by nature of king on 2018/6/8.
 */
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * @author wangzhinan
 * @create 2018-06-08 14:32
 * @desc 任务字典
 **/
@Entity
@Table(name = "wlyy_health_bank_task_dict" )
public class TaskDictDO extends IdEntityWithOperation implements Serializable {
    @Column(name = "saas_id")
    private  String saasId;//环境id
    @Column(name = "dictType")
    private String dictType;//字典类型
    @Column(name = "dict_code")
    private String dictCode;//字典code
    @Column(name = "dict_name")
    private String dictName;//字典名称
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getDictType() {
        return dictType;
    }
    public void setDictType(String dictType) {
        this.dictType = dictType;
    }
    public String getDictCode() {
        return dictCode;
    }
    public void setDictCode(String dictCode) {
        this.dictCode = dictCode;
    }
    public String getDictName() {
        return dictName;
    }
    public void setDictName(String dictName) {
        this.dictName = dictName;
    }
}

+ 75 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskGoodsDO.java

@ -0,0 +1,75 @@
package com.yihu.jw.entity.health.bank;/**
 * Created by nature of king on 2018/6/8.
 */
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * @author wangzhinan
 * @create 2018-06-08 14:40
 * @desc 活动商品
 **/
@Entity
@Table(name = "wlyy_health_bank_task_goods")
public class TaskGoodsDO extends IdEntityWithOperation implements Serializable {
    @Column(name = "saas_id")
    private String saasId;//环境id
    @Column(name = "task_id")
    private String taskId;//任务id
    @Column(name = "img")
    private String img;//商品图片
    @Column(name = "name")
    private String name;//商品名称
    @Column(name = "integrate")
    private int integrate;//积分
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getTaskId() {
        return taskId;
    }
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
    public String getImg() {
        return img;
    }
    public void setImg(String img) {
        this.img = img;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getIntegrate() {
        return integrate;
    }
    public void setIntegrate(int integrate) {
        this.integrate = integrate;
    }
}

+ 160 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskPatientDetailDO.java

@ -0,0 +1,160 @@
package com.yihu.jw.entity.health.bank;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
/**
 * Created by wamg zhinan 2018/4/27.
 */
@Entity
@Table(name = "wlyy_health_bank_task_patient_detail")
public class TaskPatientDetailDO extends IdEntityWithOperation implements Serializable{
    @Column(name = "saas_id")
    private String saasId; //saasid
    @Column(name = "status")
    private Integer status;//任务完整状态:1完成,0参与,-1作废
    @Column(name = "patient_id")
    private String patientId;//居民id
    @Column(name = "patient_idcard")
    private String patientIdcard;//居民身份证
    @Column(name = "patient_openid")
    private String patientOpenid;//居民openid
    @Column(name = "doctor_id")
    private String doctorId;//医生id
    @Column(name = "task_id")
    private String taskId;//任务id
    @Column(name = "activity_id")
    private String activityId;//活动id
    @Column(name = "total")
    private Long total;//活动中获取的积分
    @Column(name = "union_id")
    private String unionId;
    @Transient
    private AccountDO accountDO;//账户信息
    @Transient
    private Integer isFlag;//标识是否为当前用户
    @Transient
    private String taskCode;//任务标识
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getPatientId() {
        return patientId;
    }
    public void setPatientId(String patientId) {
        this.patientId = patientId;
    }
    public String getPatientIdcard() {
        return patientIdcard;
    }
    public void setPatientIdcard(String patientIdcard) {
        this.patientIdcard = patientIdcard;
    }
    public String getPatientOpenid() {
        return patientOpenid;
    }
    public void setPatientOpenid(String patientOpenid) {
        this.patientOpenid = patientOpenid;
    }
    public String getDoctorId() {
        return doctorId;
    }
    public void setDoctorId(String doctorId) {
        this.doctorId = doctorId;
    }
    public String getTaskId() {
        return taskId;
    }
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
    public String getActivityId() {
        return activityId;
    }
    public void setActivityId(String activityId) {
        this.activityId = activityId;
    }
    public Long getTotal() {
        return total;
    }
    public void setTotal(Long total) {
        this.total = total;
    }
    public AccountDO getAccountDO() {
        return accountDO;
    }
    public void setAccountDO(AccountDO accountDO) {
        this.accountDO = accountDO;
    }
    public String getUnionId() {
        return unionId;
    }
    public void setUnionId(String unionId) {
        this.unionId = unionId;
    }
    public Integer getIsFlag() {
        return isFlag;
    }
    public void setIsFlag(Integer isFlag) {
        this.isFlag = isFlag;
    }
    public String getTaskCode() {
        return taskCode;
    }
    public void setTaskCode(String taskCode) {
        this.taskCode = taskCode;
    }
}

+ 75 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskRangDO.java

@ -0,0 +1,75 @@
package com.yihu.jw.entity.health.bank;/**
 * Created by nature of king on 2018/6/8.
 */
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * @author wangzhinan
 * @create 2018-06-08 14:43
 * @desc 活动范围
 **/
@Entity
@Table(name = "wlyy_health_bank_task_rang")
public class TaskRangDO extends IdEntityWithOperation implements Serializable {
    @Column(name = "saas_id")
    private String saasId;//环境id
    @Column(name = "task_id")
    private String taskId;//任务id
    @Column(name = "key")
    private String key;//范围KEY
    @Column(name = "value")
    private String value;// 范围value
    @Column(name = "status")
    private int status;//状态
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getTaskId() {
        return taskId;
    }
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    }
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
}

+ 79 - 12
common/common-entity/src/main/java/com/yihu/jw/entity/health/bank/TaskRuleDO.java

@ -17,11 +17,30 @@ public class TaskRuleDO extends IdEntityWithOperation implements Serializable{
    @Column(name = "saas_id")
    private String saasId; //saasid
    @Column(name = "task_id")
    private String taskId; //任务id
    @Column(name = "name")
    private String name;//规则名称
    @Column(name = "description")
    private String description;//规则描述
    @Column(name = "integrate")
    private Integer integrate; //积分
    @Column(name = "trade_direction")
    private Integer tradeDirection;//交易方向 1增、-1减、0清零
    @Column(name = "type")
    private String type;//规则类型:NORMAL-手动,AUTO-自动
    @Column(name = "status")
    private Integer status; //状态
    @Column(name = "java_class_path")
    private String javaClassPath;//java反射类路径
    @Column(name = "period")
    private Integer period;//周期性
    @Column(name = "rule_code")
    private String ruleCode; //任务编码
    public String getSaasId() {
        return saasId;
@ -31,19 +50,67 @@ public class TaskRuleDO extends IdEntityWithOperation implements Serializable{
        this.saasId = saasId;
    }
    public String getTaskId() {
        return taskId;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public Integer getIntegrate() {
        return integrate;
    }
    public void setIntegrate(Integer integrate) {
        this.integrate = integrate;
    }
    public Integer getTradeDirection() {
        return tradeDirection;
    }
    public void setTradeDirection(Integer tradeDirection) {
        this.tradeDirection = tradeDirection;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getJavaClassPath() {
        return javaClassPath;
    }
    public void setTaskId(String taskId) {
        this.taskId = taskId;
    public void setJavaClassPath(String javaClassPath) {
        this.javaClassPath = javaClassPath;
    }
    public String getRuleCode() {
        return ruleCode;
    public Integer getPeriod() {
        return period;
    }
    public void setRuleCode(String ruleCode) {
        this.ruleCode = ruleCode;
    public void setPeriod(Integer period) {
        this.period = period;
    }
}

+ 39 - 21
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientHospitalRecordDO.java

@ -13,29 +13,48 @@ import java.io.Serializable;
@Entity
@Table(name = "wlyy_patient_hospital_record")
public class PatientHospitalRecordDO extends IdEntityWithOperation implements Serializable {
    @Column(name = "saas_id")
    private String saasId;//
    @Column(name = "third_code")
    private String thirdCode;//智业记录code
    @Column(name = "event_code")
    private String eventCode; // 事件code
    @Column(name = "patient")
    private String patient;//患者
    @Column(name = "patient_name")
    private String patientName;//患者姓名
    @Column(name = "type")
    private String type;//出院:1;住院:0
    @Column(name = "hospital")
    private String hospital; //医院
    @Column(name = "hospital_name")
    private String hospitalName;
    @Column(name = "doctor")
    private String doctor; //医生
    @Column(name = "doctor_name")
    private String doctorName;
    @Column(name = "city")
    private String city; //城市
    @Column(name = "city_name")
    private String cityName;
    @Column(name = "town")
    private String town; //城镇
    @Column(name = "town_name")
    private String townName;
    @Column(name = "remark")
    private String remark; //备注
    @Column(name = "diagnosis")
    private String diagnosis; //诊断
    @Column(name = "label")
    private String label; //标签
    @Column(name = "label_name")
    private String labelName;
    @Column(name = "dept")
    private String dept;//部门
    @Column(name = "dept_name")
    private String deptName;
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
@ -44,7 +63,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.saasId = saasId;
    }
    @Column(name = "third_code")
    public String getThirdCode() {
        return thirdCode;
    }
@ -53,7 +72,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.thirdCode = thirdCode;
    }
    @Column(name = "event_code")
    public String getEventCode() {
        return eventCode;
    }
@ -62,7 +81,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.eventCode = eventCode;
    }
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
@ -71,7 +90,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
@ -80,7 +99,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.hospitalName = hospitalName;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
@ -89,7 +108,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
@ -98,7 +117,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.doctorName = doctorName;
    }
    @Column(name = "city")
    public String getCity() {
        return city;
    }
@ -107,7 +126,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.city = city;
    }
    @Column(name = "city_name")
    public String getCityName() {
        return cityName;
    }
@ -116,7 +135,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.cityName = cityName;
    }
    @Column(name = "town")
    public String getTown() {
        return town;
    }
@ -125,7 +144,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.town = town;
    }
    @Column(name = "town_name")
    public String getTownName() {
        return townName;
    }
@ -134,7 +153,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.townName = townName;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
@ -143,7 +162,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.remark = remark;
    }
    @Column(name = "diagnosis")
    public String getDiagnosis() {
        return diagnosis;
    }
@ -152,7 +171,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.diagnosis = diagnosis;
    }
    @Column(name = "label")
    public String getLabel() {
        return label;
    }
@ -161,7 +180,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.label = label;
    }
    @Column(name = "label_name")
    public String getLabelName() {
        return labelName;
    }
@ -170,7 +189,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.labelName = labelName;
    }
    @Column(name = "dept")
    public String getDept() {
        return dept;
    }
@ -179,7 +198,6 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.dept = dept;
    }
    @Column(name = "dept_ame")
    public String getDeptName() {
        return deptName;
    }
@ -188,7 +206,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.deptName = deptName;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
@ -197,7 +215,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
@ -206,7 +224,7 @@ public class PatientHospitalRecordDO extends IdEntityWithOperation implements Se
        this.patientName = patientName;
    }
    @Column(name = "type")
    public String getType() {
        return type;
    }

+ 94 - 87
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelDO.java

@ -1,87 +1,94 @@
package com.yihu.jw.entity.specialist;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * Created by Trick on 2018/5/29.
 */
@Entity
@Table(name = "wlyy_patient_label")
public class PatientLabelDO extends IdEntityWithOperation implements Serializable {
    private String saasId;
    private String labelName;//标签名称',
    private String labelCode;//标签code',
    private String labelType;//标签类型:1.装病类型;2.健康情况;3.自定义',
    private Integer sort;//排序',
    private String teamCode;//团队code',
    private String del;//1:有效;0:删除',
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "label_name")
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
    @Column(name = "label_code")
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    @Column(name = "label_type")
    public String getLabelType() {
        return labelType;
    }
    public void setLabelType(String labelType) {
        this.labelType = labelType;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    @Column(name = "team_code")
    public String getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }
    @Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/5/29.
// */
//@Entity
//@Table(name = "wlyy_patient_label")
//public class PatientLabelDO extends IdEntityWithOperation implements Serializable {
//
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "label_name")
//    private String labelName;//标签名称',
//    @Column(name = "label_code")
//    private String labelCode;//标签code',
//    @Column(name = "label_type")
//    private String labelType;//标签类型:1.装病类型;2.健康情况;3.自定义',
//    @Column(name = "sort")
//    private Integer sort;//排序',
//    @Column(name = "team_code")
//    private String teamCode;//团队code',
//    @Column(name = "del")
//    private String del;//1:有效;0:删除',
//
//
//    public String getSaasId() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getLabelName() {
//        return labelName;
//    }
//
//    public void setLabelName(String labelName) {
//        this.labelName = labelName;
//    }
//
//
//    public String getLabelCode() {
//        return labelCode;
//    }
//
//    public void setLabelCode(String labelCode) {
//        this.labelCode = labelCode;
//    }
//
//
//    public String getLabelType() {
//        return labelType;
//    }
//
//    public void setLabelType(String labelType) {
//        this.labelType = labelType;
//    }
//
//
//    public Integer getSort() {
//        return sort;
//    }
//
//    public void setSort(Integer sort) {
//        this.sort = sort;
//    }
//
//
//    public String getTeamCode() {
//        return teamCode;
//    }
//
//    public void setTeamCode(String teamCode) {
//        this.teamCode = teamCode;
//    }
//
//
//    public String getDel() {
//        return del;
//    }
//
//    public void setDel(String del) {
//        this.del = del;
//    }
//}

+ 83 - 77
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/PatientLabelInfoDO.java

@ -1,77 +1,83 @@
package com.yihu.jw.entity.specialist;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * Created by Trick on 2018/5/29.
 */
@Entity
@Table(name = "wlyy_patient_label_info")
public class PatientLabelInfoDO extends IdEntityWithOperation implements Serializable {
    private String saasId;
    private String patient;//居民code',
    private String labelName;//标签名称',
    private String labelCode;//标签code',
    private String labelType;//标签类别',
    private String teamCode;//团队code',
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "label_name")
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
    @Column(name = "label_code")
    public String getLabelCode() {
        return labelCode;
    }
    public void setLabelCode(String labelCode) {
        this.labelCode = labelCode;
    }
    @Column(name = "label_type")
    public String getLabelType() {
        return labelType;
    }
    public void setLabelType(String labelType) {
        this.labelType = labelType;
    }
    @Column(name = "team_code")
    public String getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(String teamCode) {
        this.teamCode = teamCode;
    }
}
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/5/29.
// */
//@Entity
//@Table(name = "wlyy_patient_label_info")
//public class PatientLabelInfoDO extends IdEntityWithOperation implements Serializable {
//
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "patient")
//    private String patient;//居民code',
//    @Column(name = "label_name")
//    private String labelName;//标签名称',
//    @Column(name = "label_code")
//    private String labelCode;//标签code',
//    @Column(name = "label_type")
//    private String labelType;//标签类别',
//    @Column(name = "team_code")
//    private String teamCode;//团队code',
//
//
//    public String getSaasId() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getPatient() {
//        return patient;
//    }
//
//    public void setPatient(String patient) {
//        this.patient = patient;
//    }
//
//
//    public String getLabelName() {
//        return labelName;
//    }
//
//    public void setLabelName(String labelName) {
//        this.labelName = labelName;
//    }
//
//
//    public String getLabelCode() {
//        return labelCode;
//    }
//
//    public void setLabelCode(String labelCode) {
//        this.labelCode = labelCode;
//    }
//
//
//    public String getLabelType() {
//        return labelType;
//    }
//
//    public void setLabelType(String labelType) {
//        this.labelType = labelType;
//    }
//
//
//    public String getTeamCode() {
//        return teamCode;
//    }
//
//    public void setTeamCode(String teamCode) {
//        this.teamCode = teamCode;
//    }
//}

+ 83 - 77
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistArticleDO.java

@ -1,77 +1,83 @@
package com.yihu.jw.entity.specialist;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * Created by Trick on 2018/4/24.
 */
@Entity
@Table(name = "wlyy_specialist_Article")
public class SpecialistArticleDO extends IdEntityWithOperation implements Serializable {
    private String saasId;
    private String patient;//居民
    private String patientName;//居民
    private String doctor;//医生
    private String doctorName;//医生
    private String article;//文章
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "article")
    public String getArticle() {
        return article;
    }
    public void setArticle(String article) {
        this.article = article;
    }
}
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/4/24.
// */
//@Entity
//@Table(name = "wlyy_specialist_Article")
//public class SpecialistArticleDO extends IdEntityWithOperation implements Serializable {
//
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "patient")
//    private String patient;//居民
//    @Column(name = "patient_name")
//    private String patientName;//居民
//    @Column(name = "doctor")
//    private String doctor;//医生
//    @Column(name = "doctor_name")
//    private String doctorName;//医生
//    @Column(name = "article")
//    private String article;//文章
//
//
//    public String getSaasId() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getPatient() {
//        return patient;
//    }
//
//    public void setPatient(String patient) {
//        this.patient = patient;
//    }
//
//
//    public String getPatientName() {
//        return patientName;
//    }
//
//    public void setPatientName(String patientName) {
//        this.patientName = patientName;
//    }
//
//
//    public String getDoctor() {
//        return doctor;
//    }
//
//    public void setDoctor(String doctor) {
//        this.doctor = doctor;
//    }
//
//
//    public String getDoctorName() {
//        return doctorName;
//    }
//
//    public void setDoctorName(String doctorName) {
//        this.doctorName = doctorName;
//    }
//
//
//    public String getArticle() {
//        return article;
//    }
//
//    public void setArticle(String article) {
//        this.article = article;
//    }
//}

+ 126 - 117
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistConsultDO.java

@ -1,117 +1,126 @@
package com.yihu.jw.entity.specialist;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * Created by Trick on 2018/4/24.
 */
@Entity
@Table(name = "wlyy_specialist_consult")
public class SpecialistConsultDO extends IdEntityWithOperation implements Serializable {
    private String saasId;
    private String consult;//关联咨询code
    private String doctor;//专科医生
    private String doctorName;//专科医生姓名
    private String type;//类型:1.家庭医生咨询,2.居民咨询
    private String member;//咨询对象
    private String memberName;//咨询对象
    private String status;// 1.咨询完成,0.咨询进行中
    private String reply;// 1.专科医生已经参与;0.~未参与
    private String content;//咨询内容
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "consult")
    public String getConsult() {
        return consult;
    }
    public void setConsult(String consult) {
        this.consult = consult;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    @Column(name = "type")
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "member")
    public String getMember() {
        return member;
    }
    public void setMember(String member) {
        this.member = member;
    }
    @Column(name = "member_name")
    public String getMemberName() {
        return memberName;
    }
    public void setMemberName(String memberName) {
        this.memberName = memberName;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    @Column(name = "reply")
    public String getReply() {
        return reply;
    }
    public void setReply(String reply) {
        this.reply = reply;
    }
    @Column(name = "content")
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
}
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/4/24.
// */
//@Entity
//@Table(name = "wlyy_specialist_consult")
//public class SpecialistConsultDO extends IdEntityWithOperation implements Serializable {
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "consult")
//    private String consult;//关联咨询code
//    @Column(name = "doctor")
//    private String doctor;//专科医生
//    @Column(name = "doctor_name")
//    private String doctorName;//专科医生姓名
//    @Column(name = "type")
//    private String type;//类型:1.家庭医生咨询,2.居民咨询
//    @Column(name = "member")
//    private String member;//咨询对象
//    @Column(name = "member_name")
//    private String memberName;//咨询对象
//    @Column(name = "status")
//    private String status;// 1.咨询完成,0.咨询进行中
//    @Column(name = "reply")
//    private String reply;// 1.专科医生已经参与;0.~未参与
//    @Column(name = "content")
//    private String content;//咨询内容
//
//
//    public String getSaasId() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getConsult() {
//        return consult;
//    }
//
//    public void setConsult(String consult) {
//        this.consult = consult;
//    }
//
//
//    public String getDoctor() {
//        return doctor;
//    }
//
//    public void setDoctor(String doctor) {
//        this.doctor = doctor;
//    }
//
//
//    public String getDoctorName() {
//        return doctorName;
//    }
//
//    public void setDoctorName(String doctorName) {
//        this.doctorName = doctorName;
//    }
//
//
//    public String getType() {
//        return type;
//    }
//
//    public void setType(String type) {
//        this.type = type;
//    }
//
//
//    public String getMember() {
//        return member;
//    }
//
//    public void setMember(String member) {
//        this.member = member;
//    }
//
//
//    public String getMemberName() {
//        return memberName;
//    }
//
//    public void setMemberName(String memberName) {
//        this.memberName = memberName;
//    }
//
//
//    public String getStatus() {
//        return status;
//    }
//
//    public void setStatus(String status) {
//        this.status = status;
//    }
//
//
//    public String getReply() {
//        return reply;
//    }
//
//    public void setReply(String reply) {
//        this.reply = reply;
//    }
//
//
//    public String getContent() {
//        return content;
//    }
//
//    public void setContent(String content) {
//        this.content = content;
//    }
//}

+ 116 - 108
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistDO.java

@ -1,108 +1,116 @@
package com.yihu.jw.entity.specialist;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
/**
 * Created by Trick on 2018/4/24.
 */
@Entity
@Table(name = "wlyy_specialist")
public class SpecialistDO extends IdEntityWithOperation implements Serializable {
    private String saasId;
    private String name; //专科医生姓名
    private String profession; //专业
    private String professionName; // 专业名称
    private String dept; //科室
    private String deptName; //科室名称
    private String hospital;//医院
    private String hospitalName;//医院名称
    private String del;//1:有效;0:删除
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "profession")
    public String getProfession() {
        return profession;
    }
    public void setProfession(String profession) {
        this.profession = profession;
    }
    @Column(name = "profession_name")
    public String getProfessionName() {
        return professionName;
    }
    public void setProfessionName(String professionName) {
        this.professionName = professionName;
    }
    @Column(name = "dept")
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    @Column(name = "dept_name")
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    @Column(name = "hospital")
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    @Column(name = "hospital_name")
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    @Column(name = "del")
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}
//package com.yihu.jw.entity.specialist;
//
//import com.yihu.jw.IdEntityWithOperation;
//
//import javax.persistence.Column;
//import javax.persistence.Entity;
//import javax.persistence.Table;
//import java.io.Serializable;
//
///**
// * Created by Trick on 2018/4/24.
// */
//@Entity
//@Table(name = "wlyy_specialist")
//public class SpecialistDO extends IdEntityWithOperation implements Serializable {
//    @Column(name = "saas_id")
//    private String saasId;
//    @Column(name = "name")
//    private String name; //专科医生姓名
//    @Column(name = "profession")
//    private String profession; //专业
//    @Column(name = "profession_name")
//    private String professionName; // 专业名称
//    @Column(name = "dept")
//    private String dept; //科室
//    @Column(name = "dept_name")
//    private String deptName; //科室名称
//
//    @Column(name = "hospital")
//    private String hospital;//医院
//    @Column(name = "hospital_name")
//    private String hospitalName;//医院名称
//    @Column(name = "del")
//    private String del;//1:有效;0:删除
//
//
//    public String getSaasId() {
//        return saasId;
//    }
//
//    public void setSaasId(String saasId) {
//        this.saasId = saasId;
//    }
//
//
//    public String getName() {
//        return name;
//    }
//
//    public void setName(String name) {
//        this.name = name;
//    }
//
//
//    public String getProfession() {
//        return profession;
//    }
//
//    public void setProfession(String profession) {
//        this.profession = profession;
//    }
//
//
//    public String getProfessionName() {
//        return professionName;
//    }
//
//
//    public void setProfessionName(String professionName) {
//        this.professionName = professionName;
//    }
//
//
//    public String getDept() {
//        return dept;
//    }
//
//    public void setDept(String dept) {
//        this.dept = dept;
//    }
//
//
//    public String getDeptName() {
//        return deptName;
//    }
//
//    public void setDeptName(String deptName) {
//        this.deptName = deptName;
//    }
//
//    public String getHospital() {
//        return hospital;
//    }
//
//    public void setHospital(String hospital) {
//        this.hospital = hospital;
//    }
//
//
//    public String getHospitalName() {
//        return hospitalName;
//    }
//
//    public void setHospitalName(String hospitalName) {
//        this.hospitalName = hospitalName;
//    }
//
//
//    public String getDel() {
//        return del;
//    }
//
//    public void setDel(String del) {
//        this.del = del;
//    }
//}

+ 61 - 22
common/common-entity/src/main/java/com/yihu/jw/entity/specialist/SpecialistPatientRelationDO.java

@ -15,26 +15,66 @@ import java.util.Date;
@Table(name = "wlyy_specialist_patient_relation")
public class SpecialistPatientRelationDO extends IdEntityWithOperation implements Serializable {
    @Column(name = "saas_id")
    private String saasId;
    @Column(name = "discharge_record")
    private String dischargeRecord;//最新出院记录
    @Column(name = "doctor")
    private String doctor;//专科医生
    @Column(name = "doctor_name")
    private String doctorName;//专科医生姓名
    @Column(name = "patient")
    private String patient;// 居民(患者)
    @Column(name = "patient_name")
    private String patientName;//居民(患者)姓名
    @Column(name = "health_assistant")
    private String healthAssistant;//计管师
    @Column(name = "health_assistant_name")
    private String healthAssistantName;//计管师
    private String status;//1.已经分配,0,待分配
    @Column(name = "sign_status")
    private String signStatus;//居民与专科医生签约状态: -2 医生拒绝,-1 已经取消,0待审核,1同意',
    @Column(name = "status")
    private String status;//1.已经分配,0,待分配,-1失效
    @Column(name = "pk_code")
    private String pkCode; //服务包code
    @Column(name = "sign_code")
    private String signCode;//签约code
    @Column(name = "sign_doctor")
    private String signDoctor;//签约医生
    @Column(name = "sign_doctor_name")
    private String signDoctorName;//签约医生
    @Column(name = "health_doctor")
    private String healthDoctor;//健康管理师
    @Column(name = "health_doctor_name")
    private String healthDoctorName;//健康管理师姓名
    @Column(name = "sign_year")
    private String signYear;//签约年度
    private Integer teamCode;//签约团队
    @Column(name = "team_code")
    private Integer teamCode;//专科医生签约团队',
    @Column(name = "sign_date")
    private Date signDate;//签约日期
    @Column(name = "remark")
    private String remark;//记录专科医生审核原因等
    @Column(name = "saas_id")
    public String getSaasId() {
        return saasId;
    }
@ -43,7 +83,7 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.saasId = saasId;
    }
    @Column(name = "discharge_record")
    public String getDischargeRecord() {
        return dischargeRecord;
    }
@ -52,7 +92,7 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.dischargeRecord = dischargeRecord;
    }
    @Column(name = "doctor")
    public String getDoctor() {
        return doctor;
    }
@ -61,7 +101,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.doctor = doctor;
    }
    @Column(name = "doctor_name")
    public String getDoctorName() {
        return doctorName;
    }
@ -70,7 +109,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.doctorName = doctorName;
    }
    @Column(name = "patient")
    public String getPatient() {
        return patient;
    }
@ -79,7 +117,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.patient = patient;
    }
    @Column(name = "patient_name")
    public String getPatientName() {
        return patientName;
    }
@ -88,7 +125,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.patientName = patientName;
    }
    @Column(name = "status")
    public String getStatus() {
        return status;
    }
@ -97,7 +133,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.status = status;
    }
    @Column(name = "sign_code")
    public String getSignCode() {
        return signCode;
    }
@ -106,7 +141,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.signCode = signCode;
    }
    @Column(name = "sign_doctor")
    public String getSignDoctor() {
        return signDoctor;
    }
@ -115,7 +149,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.signDoctor = signDoctor;
    }
    @Column(name = "sign_doctor_name")
    public String getSignDoctorName() {
        return signDoctorName;
    }
@ -124,7 +157,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.signDoctorName = signDoctorName;
    }
    @Column(name = "health_doctor")
    public String getHealthDoctor() {
        return healthDoctor;
    }
@ -133,7 +165,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.healthDoctor = healthDoctor;
    }
    @Column(name = "health_doctor_name")
    public String getHealthDoctorName() {
        return healthDoctorName;
    }
@ -142,7 +173,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.healthDoctorName = healthDoctorName;
    }
    @Column(name = "sign_year")
    public String getSignYear() {
        return signYear;
    }
@ -151,9 +181,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.signYear = signYear;
    }
    @Column(name = "sign_date")
    public Date getSignDate() {
        return signDate;
    }
@ -162,7 +189,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.signDate = signDate;
    }
    @Column(name = "team_code")
    public Integer getTeamCode() {
        return teamCode;
    }
@ -171,7 +197,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.teamCode = teamCode;
    }
    @Column(name = "health_assistant")
    public String getHealthAssistant() {
        return healthAssistant;
    }
@ -180,7 +205,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.healthAssistant = healthAssistant;
    }
    @Column(name = "health_assistant_name")
    public String getHealthAssistantName() {
        return healthAssistantName;
    }
@ -189,7 +213,6 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
        this.healthAssistantName = healthAssistantName;
    }
    @Column(name = "pk_code")
    public String getPkCode() {
        return pkCode;
    }
@ -197,4 +220,20 @@ public class SpecialistPatientRelationDO extends IdEntityWithOperation implement
    public void setPkCode(String pkCode) {
        this.pkCode = pkCode;
    }
    public String getSignStatus() {
        return signStatus;
    }
    public void setSignStatus(String signStatus) {
        this.signStatus = signStatus;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 10 - 0
common/common-entity/src/main/java/com/yihu/jw/rehabilitation/RehabilitationPlanningDO.java

@ -23,6 +23,8 @@ public class RehabilitationPlanningDO extends IdEntityWithOperation implements S
    private String patientId;//居民ID
    @Column(name = "program_id")
    private String programId;//治疗方案ID,可多个用逗号隔开
    @Column(name = "status")
    private Integer status;//计划执行状态,0执行1终止
    @Column(name = "recheck_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date recheckTime;//复检时间
@ -53,6 +55,14 @@ public class RehabilitationPlanningDO extends IdEntityWithOperation implements S
        this.programId = programId;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Date getRecheckTime() {
        return recheckTime;
    }

+ 3 - 3
common/common-entity/src/main/java/com/yihu/jw/rehabilitation/RehabilitationTreatmentProgramDO.java

@ -22,7 +22,7 @@ public class RehabilitationTreatmentProgramDO extends IdEntityWithOperation impl
    @Column(name =  "frequency")
    private String frequency;
    @Column(name = "times_daily")
    private Integer timesDaily;
    private String timesDaily;
    @Column(name = "description")
    private String description;
@ -50,11 +50,11 @@ public class RehabilitationTreatmentProgramDO extends IdEntityWithOperation impl
        this.frequency = frequency;
    }
    public Integer getTimesDaily() {
    public String getTimesDaily() {
        return timesDaily;
    }
    public void setTimesDaily(Integer timesDaily) {
    public void setTimesDaily(String timesDaily) {
        this.timesDaily = timesDaily;
    }

+ 25 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/health/bank/HealthBankMapping.java

@ -13,14 +13,33 @@ public class HealthBankMapping {
        public static final String createAccount = "/createAccount";
        public static final String selectAccount = "/selectAccount";
        public static final String findAccount = "/findAccount";
        public static final String findAccounByCondition ="/findAccounByCondition";
        public static final String createTask = "/createTask";
        public static final String deleteTask ="/deleteTask";
        public static final String findTask = "/findTask";
        public static final String updateTask ="/updateTask";
        public static final String batchTask = "/batchTask";
        public static final String selectByCode ="/selectByCode";
        public static final String createTaskDetail = "/createTaskDetail";
        public static final String createTaskRule = "/createTaskRule";
        public static final String updateTaskRule = "/updateTaskRule";
        public static final String findTaskRule ="/findTaskRule";
        public static final String batchTaskRule = "/batchTaskRule";
        public static final String createTaskDict = "/createTaskDict";
        public static final String updateTaskDict = "/updateTaskDict";
        public static final String findTaskDict ="/findTaskDict";
        public static final String createTaskGoods = "/createTaskGoods";
        public static final String updateTaskGoods = "/updateTaskGoods";
        public static final String findTaskGoods ="/findTaskGoods";
        public static final String createTaskRang = "/createTaskRang";
        public static final String updateTaskRang = "/updateTaskRang";
        public static final String findTaskRang = "/findTaskRang";
        public static final String attendTask = "/attendTask";
        public static final String selectByPatient = "/selectByPatient";
        public static final String createActivity="/createActivity";
        public static final String findActivity="/findActivity";
        public static final String updateActivity="/updateActivity";
        public static final String batchActivity = "/batchActivity";
        public static final String createActivityInfo ="/createActivityInfo";
        public static final String findActivityInfo = "/findActivityInfo";
        public static final String updateActivityInfo ="/updateActivityInfo";
@ -29,9 +48,15 @@ public class HealthBankMapping {
        public static final String updateGoods ="/updateGoods";
        public static final String createCreditsDetail = "/createCreditsDetail";
        public static final String findCreditsLogInfo ="/findCreditsLogInfo";
        public static final String selectByActivity = "/selectByActivity";
        public static final String selectByRanking = "/selectByRanking";
        public static final String selectByActivityRanking = "/selectByActivityRanking";
        public static final String selectByActivityRanking1 = "/selectByActivityRanking1";
        public static final String updateCreditsLogInfo ="/updateCreditsLogInfo";
        public static final String exchangeGoods = "/exchangeGoods";
        public static final String findExchangeGoods="/findExchangeGoods";
        public static final String createActiveRecord="/createActiveRecord";
        public static final String doctorAddIntegrate = "/doctorAddIntegrate";
        public static final String addStepIntegrate = "/addStepIntegrate";
    }
}

+ 1 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/rehabilitation/RehabilitationRequestMapping.java

@ -71,5 +71,6 @@ public class RehabilitationRequestMapping {
        public static final String api_update = "updatePerformance";
        public static final String findPerformanceById = "findPerformanceById";
        public static final String findPerformanceByPatientId = "findPerformanceByPatientId";
    }
}

+ 28 - 0
common/common-request-mapping/src/main/java/com/yihu/jw/rm/specialist/SpecialistMapping.java

@ -8,6 +8,8 @@ public class SpecialistMapping {
    public static final String api_specialist_common = "svr-specialist";
    public static final Integer api_specialist_fail = -1;
    public static final String api_success ="succes";
    public static final String doctor_exist ="doctor_exist";
    public static final String team_exist ="team_exist";
    public static class specialist{
@ -16,5 +18,31 @@ public class SpecialistMapping {
        public static final String createConsult = "/createConsult";
        public static final String createArticle = "/createArticle";
        public static final String findSpecialistPatientRelation = "/findSpecialistPatientRelation";
        public static final String findSpecialistPatientRelationCout = "/findSpecialistPatientRelationCout";
        public static final String findNoLabelPatientRelation ="/findNoLabelPatientRelation";
        public static final String saveHealthAssistant ="/saveHealthAssistant";
        public static final String findPatientRelatioByAssistant ="/findPatientRelatioByAssistant";
        public static final String getPatientByLabel ="/getPatientByLabel";
        public static final String getLabelpatientCount ="/getLabelpatientCount";
        public static final String getAssistantPatientCount ="/getAssistantPatientCount";
        public static final String getDoctorPatientByName ="/getDoctorPatientByName";
        public static final String findPatientNoAssistant ="/findPatientNoAssistant";
        public static final String signSpecialistTeam ="/signSpecialistTeam";
        public static final String agreeSpecialistTeam ="/agreeSpecialistTeam";
        public static final String findPatientSigninfo ="/findPatientSigninfo";
        public static final String findPatientTeamList ="/findPatientTeamList";
        public static final String findPatientSignSpecialist ="/findPatientSignSpecialist";
        public static final String findPatientSignSpecialistInfo ="/findPatientSignSpecialistInfo";
    }
    public static class screen{
        public static final String getScreenResult ="/getScreenResult";
        public static final String getScreenCount = "/getScreenCount";
        public static final String getScreenResultDetail = "/getScreenResultDetail";
    }
}

+ 0 - 23
common/common-rest-model-es/src/main/java/common/SaveModel.java

@ -1,23 +0,0 @@
package common;
import io.searchbox.annotations.JestId;
/**
 * @author yeshijie on 2018/3/2.
 */
public class SaveModel {
    @JestId
    private String id;
    public SaveModel() {
    }
    public String getId() {
        return this.id;
    }
    public void setId(String id) {
        this.id = id;
    }
}

+ 13 - 2
common/common-rest-model-es/src/main/java/iot/device/LocationDataVO.java

@ -1,7 +1,7 @@
package iot.device;
import com.fasterxml.jackson.annotation.JsonInclude;
import common.SaveModel;
import io.searchbox.annotations.JestId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
@ -12,7 +12,10 @@ import org.springframework.data.elasticsearch.core.geo.GeoPoint;
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "设备地址信息", description = "设备地址信息")
public class LocationDataVO extends SaveModel {
public class LocationDataVO {
    @JestId
    private String id;
    @ApiModelProperty("设备绑定的居民身份证")
    private String idCard;
@ -38,6 +41,14 @@ public class LocationDataVO extends SaveModel {
    @ApiModelProperty("创建时间")
    private String createTime;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getIdCard() {
        return idCard;
    }

+ 13 - 0
common/common-rest-model/pom.xml

@ -31,6 +31,7 @@
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-exception</artifactId>
            <version>${parent.version}</version>
        </dependency>
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
@ -52,5 +53,17 @@
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.social</groupId>
            <artifactId>spring-social-core</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-exception</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-exception</artifactId>
        </dependency>
    </dependencies>
</project>

+ 1 - 2
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/EnvelopRestController.java

@ -2,8 +2,7 @@ package com.yihu.jw.restmodel.common;
import com.fasterxml.jackson.databind.ObjectMapper;
//import com.yihu.jw.exception.ApiException;
//import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.util.date.DateUtil;

+ 10 - 3
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/rehabilitation/RehabilitationPlanningVO.java

@ -18,14 +18,13 @@ import java.util.Date;
public class RehabilitationPlanningVO extends BaseVO implements Serializable {
    @ApiModelProperty("居民id")
    private String patientId;
    @ApiModelProperty("治疗方案id")
    private String programId;
    @ApiModelProperty("计划执行状态")
    private Integer status;
    @ApiModelProperty("复检时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    private Date recheckTime;
    @ApiModelProperty("附加说明")
    private String description;
@ -45,6 +44,14 @@ public class RehabilitationPlanningVO extends BaseVO implements Serializable {
        this.programId = programId;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public Date getRecheckTime() {
        return recheckTime;
    }

+ 3 - 3
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/rehabilitation/RehabilitationTreatmentProgramVO.java

@ -19,7 +19,7 @@ public class RehabilitationTreatmentProgramVO extends BaseVO implements Serializ
    @ApiModelProperty("训练次数/时间")
    private String frequency;
    @ApiModelProperty("每日次数")
    private Integer timesDaily;
    private String timesDaily;
    @ApiModelProperty("附加说明")
    private String description;
@ -39,11 +39,11 @@ public class RehabilitationTreatmentProgramVO extends BaseVO implements Serializ
        this.frequency = frequency;
    }
    public Integer getTimesDaily() {
    public String getTimesDaily() {
        return timesDaily;
    }
    public void setTimesDaily(Integer timesDaily) {
    public void setTimesDaily(String timesDaily) {
        this.timesDaily = timesDaily;
    }

+ 34 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/AdminTeamMemberVO.java

@ -0,0 +1,34 @@
package com.yihu.jw.restmodel.specialist;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by Trick on 2018/7/4.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "专科医生团队成员", description = "专科医生团队成员")
public class AdminTeamMemberVO {
    @ApiModelProperty("医生code")
    private String doctorCode;
    @ApiModelProperty("医生姓名")
    private String doctorName;
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
}

+ 44 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/AssistantVO.java

@ -0,0 +1,44 @@
package com.yihu.jw.restmodel.specialist;
/**
 * Created by Trick on 2018/5/31.
 */
public class AssistantVO {
    private String doctor;
    private String patient;
    private String healthAssistant;
    private String healthAssistantName;
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getHealthAssistant() {
        return healthAssistant;
    }
    public void setHealthAssistant(String healthAssistant) {
        this.healthAssistant = healthAssistant;
    }
    public String getHealthAssistantName() {
        return healthAssistantName;
    }
    public void setHealthAssistantName(String healthAssistantName) {
        this.healthAssistantName = healthAssistantName;
    }
}

+ 130 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientLabelVO.java

@ -0,0 +1,130 @@
package com.yihu.jw.restmodel.specialist;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by Trick on 2018/6/8.
 */
public class PatientLabelVO {
    @ApiModelProperty("居民code")
    private String code;
    @ApiModelProperty("居民")
    private String name ;
    @ApiModelProperty("年龄")
    private String age;
    @ApiModelProperty("标签名称")
    private String labelName;
    @ApiModelProperty("标签类型")
    private String labelType;
    @ApiModelProperty("标签code")
    private String label;
    @ApiModelProperty("居民头像")
    private String photo;
    @ApiModelProperty("居民健康情况")
    private String health;
    @ApiModelProperty("居民健康情况code")
    private String healthcode;
    @ApiModelProperty("性别")
    private String sex;
    @ApiModelProperty("计管师")
    private String healthAssistant;
    @ApiModelProperty("计管师姓名")
    private String healthAssistantName;
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAge() {
        return age;
    }
    public void setAge(String age) {
        this.age = age;
    }
    public String getLabelName() {
        return labelName;
    }
    public void setLabelName(String labelName) {
        this.labelName = labelName;
    }
    public String getLabelType() {
        return labelType;
    }
    public void setLabelType(String labelType) {
        this.labelType = labelType;
    }
    public String getLabel() {
        return label;
    }
    public void setLabel(String label) {
        this.label = label;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getHealth() {
        return health;
    }
    public void setHealth(String health) {
        this.health = health;
    }
    public String getHealthcode() {
        return healthcode;
    }
    public void setHealthcode(String healthcode) {
        this.healthcode = healthcode;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getHealthAssistant() {
        return healthAssistant;
    }
    public void setHealthAssistant(String healthAssistant) {
        this.healthAssistant = healthAssistant;
    }
    public String getHealthAssistantName() {
        return healthAssistantName;
    }
    public void setHealthAssistantName(String healthAssistantName) {
        this.healthAssistantName = healthAssistantName;
    }
}

+ 30 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientRelationVO.java

@ -17,10 +17,16 @@ public class PatientRelationVO {
    private String patientName;
    @ApiModelProperty("年龄")
    private String age;
    @ApiModelProperty("性别")
    private String sex;
    @ApiModelProperty("头像")
    private String photo;
    @ApiModelProperty("出院时间")
    private String createTime;
    @ApiModelProperty("居民健康情况")
    private String health;
    @ApiModelProperty("居民健康情况code")
    private String healthcode;
    public String getPatient() {
        return patient;
@ -61,4 +67,28 @@ public class PatientRelationVO {
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public String getHealth() {
        return health;
    }
    public void setHealth(String health) {
        this.health = health;
    }
    public String getHealthcode() {
        return healthcode;
    }
    public void setHealthcode(String healthcode) {
        this.healthcode = healthcode;
    }
}

+ 198 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/PatientSignInfoVO.java

@ -0,0 +1,198 @@
package com.yihu.jw.restmodel.specialist;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
/**
 * Created by Trick on 2018/7/4.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "居民专病签约信息", description = "居民专病签约信息")
public class PatientSignInfoVO {
    @ApiModelProperty("签约Code")
    private String relationCode;
    @ApiModelProperty("居民code")
    private String patient;
    @ApiModelProperty("居民")
    private String patientName;
    @ApiModelProperty("医生code")
    private String doctor;
    @ApiModelProperty("医生")
    private String doctorName;
    @ApiModelProperty("社区")
    private String hospital;
    @ApiModelProperty("社区名称")
    private String hospitalName;
    @ApiModelProperty("头像")
    private String photo;
    @ApiModelProperty("科室code")
    private String dept;
    @ApiModelProperty("科室")
    private String deptName;
    @ApiModelProperty("团队")
    private String teamName;
    @ApiModelProperty("团队code")
    private Long teamCode;
    @ApiModelProperty("创建时间")
    private Date createTime;
    @ApiModelProperty("签约状态")
    private String signStatus;
    @ApiModelProperty("记录状态")
    private String status;
    @ApiModelProperty("医生角色")
    private String level;
    @ApiModelProperty("计管师code")
    private String healthAssistant;
    @ApiModelProperty("计管师")
    private String healthAssistantName;
    public String getRelationCode() {
        return relationCode;
    }
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getTeamName() {
        return teamName;
    }
    public void setTeamName(String teamName) {
        this.teamName = teamName;
    }
    public Long getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(Long teamCode) {
        this.teamCode = teamCode;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public String getSignStatus() {
        return signStatus;
    }
    public void setSignStatus(String signStatus) {
        this.signStatus = signStatus;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    public String getLevel() {
        return level;
    }
    public void setLevel(String level) {
        this.level = level;
    }
    public String getHealthAssistant() {
        return healthAssistant;
    }
    public void setHealthAssistant(String healthAssistant) {
        this.healthAssistant = healthAssistant;
    }
    public String getHealthAssistantName() {
        return healthAssistantName;
    }
    public void setHealthAssistantName(String healthAssistantName) {
        this.healthAssistantName = healthAssistantName;
    }
}

+ 148 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SpecialistTeamVO.java

@ -0,0 +1,148 @@
package com.yihu.jw.restmodel.specialist;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
 * Created by Trick on 2018/7/4.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "专科医生团队与居民匹配关系", description = "专科医生团队与居民匹配关系")
public class SpecialistTeamVO {
    @ApiModelProperty("签约code")
    private String relationCode;
    @ApiModelProperty("居民code")
    private String patient;
    @ApiModelProperty("居民姓名")
    private String patientName;
    @ApiModelProperty("团队id")
    private Long teamCode;
    @ApiModelProperty("团队名称")
    private String name;
    @ApiModelProperty("医生头像")
    private String photo;
    @ApiModelProperty("医生code")
    private String doctor;
    @ApiModelProperty("医生")
    private String doctorName;
    @ApiModelProperty("科室code")
    private String dept;
    @ApiModelProperty("科室")
    private String deptName;
    @ApiModelProperty("社区code")
    private String hospital;
    @ApiModelProperty("社区")
    private String hospitalName;
    @ApiModelProperty("医生团队成员")
    private List<AdminTeamMemberVO> members;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public Long getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(Long teamCode) {
        this.teamCode = teamCode;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPhoto() {
        return photo;
    }
    public void setPhoto(String photo) {
        this.photo = photo;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public String getDept() {
        return dept;
    }
    public void setDept(String dept) {
        this.dept = dept;
    }
    public String getDeptName() {
        return deptName;
    }
    public void setDeptName(String deptName) {
        this.deptName = deptName;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospitalName() {
        return hospitalName;
    }
    public void setHospitalName(String hospitalName) {
        this.hospitalName = hospitalName;
    }
    public String getRelationCode() {
        return relationCode;
    }
    public void setRelationCode(String relationCode) {
        this.relationCode = relationCode;
    }
    public List<AdminTeamMemberVO> getMembers() {
        return members;
    }
    public void setMembers(List<AdminTeamMemberVO> members) {
        this.members = members;
    }
}

+ 362 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SurveyScreenResultVo.java

@ -0,0 +1,362 @@
package com.yihu.jw.restmodel.specialist;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by zhangdan on 2018/7/6.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "筛查结果", description = "筛查结果")
public class SurveyScreenResultVo{
    @ApiModelProperty("id")
    private long id;
    @ApiModelProperty("唯一标识")
    private String code;
    //
    @ApiModelProperty("模板编码")
    private String templateCode;
    //模板标题
    @ApiModelProperty("模板标题")
    private  String templateTitle;
    //
    @ApiModelProperty("疾病类型(根据模板表的疾病类型定义)")
    private int disease;
    //
    @ApiModelProperty("全科医生code")
    private String doctor;
    //
    @ApiModelProperty("居民code")
    private String patientCode;
    //
    @ApiModelProperty("居民openid")
    private String openId;
    //
    @ApiModelProperty("居民名字")
    private String patientName;
    //筛查结果设置中相关code
    @ApiModelProperty("筛查结果唯一标识")
    private String screenResultCode;
    //筛查结果分值
    @ApiModelProperty("筛查结果分数")
    private Integer screenResultScore;
    //筛查结果
    @ApiModelProperty("筛查结果")
    private String screenResult;
    //是否高危预警(0不是  1是)
    @ApiModelProperty("是否高危预警(0不是  1是)")
    private Integer isDanger;
    //是否预约(0未预约 1已预约)
    @ApiModelProperty("是否预约(0未预约 1已预约)")
    private Integer isOrder;
    //是否跟踪(0未跟踪 1已跟踪)
    @ApiModelProperty("是否跟踪(0未跟踪 1已跟踪)")
    private Integer following;
    //是否进行健康教育(0没有  1有)
    @ApiModelProperty("是否进行健康教育(0没有  1有)")
    private Integer isEducate;
    //是否完成(0未完成 1已完成)
    @ApiModelProperty("是否完成(0未完成 1已完成)")
    private Integer over;
    //预约记录code
    @ApiModelProperty("预约记录code")
    private String reservationCode;
    //创建时间
    @ApiModelProperty("创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date czrq;
    //是否可以再次评估(0不可以 1可以)
    @ApiModelProperty("是否可以再次评估(0不可以 1可以)")
    private int isAgain;
    //再次筛查的上一份记录code
    @ApiModelProperty("再次筛查的上一份记录code")
    private String parentCode;
    //首份记录code
    @ApiModelProperty("首份记录code")
    private String originCode;
    //建议code,多个逗号隔开
    @ApiModelProperty("建议code,多个逗号隔开")
    private String adviceCode;
    //其他建议
    @ApiModelProperty("其他建议")
    private String otherAdvice;
    //来源(1医生发放  2居民自我评估)
    @ApiModelProperty("来源(1医生发放  2居民自我评估)")
    private int source;
    //更新时间
    @ApiModelProperty("更新时间")
    private Date updateTime;
    @ApiModelProperty("身份证号码")
    private String idcard;
    @ApiModelProperty("性别(1男2女3未知)")
    private String sex;
    @ApiModelProperty("年龄")
    private int age;
    @ApiModelProperty("医生类型:1专科医生,2全科医生,3健康管理师")
    private int level;
    @ApiModelProperty("筛查家庭医生姓名")
    private String doctorName;
    public SurveyScreenResultVo() {
    }
    public long getId() {
        return id;
    }
    public void setId(long id) {
        this.id = id;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getTemplateCode() {
        return templateCode;
    }
    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }
    public String getTemplateTitle() {
        return templateTitle;
    }
    public void setTemplateTitle(String templateTitle) {
        this.templateTitle = templateTitle;
    }
    public int getDisease() {
        return disease;
    }
    public void setDisease(int disease) {
        this.disease = disease;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    public String getOpenId() {
        return openId;
    }
    public void setOpenId(String openId) {
        this.openId = openId;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getScreenResultCode() {
        return screenResultCode;
    }
    public void setScreenResultCode(String screenResultCode) {
        this.screenResultCode = screenResultCode;
    }
    public Integer getScreenResultScore() {
        return screenResultScore;
    }
    public void setScreenResultScore(Integer screenResultScore) {
        this.screenResultScore = screenResultScore;
    }
    public String getScreenResult() {
        return screenResult;
    }
    public void setScreenResult(String screenResult) {
        this.screenResult = screenResult;
    }
    public Integer getIsDanger() {
        return isDanger;
    }
    public void setIsDanger(Integer isDanger) {
        this.isDanger = isDanger;
    }
    public Integer getIsOrder() {
        return isOrder;
    }
    public void setIsOrder(Integer isOrder) {
        this.isOrder = isOrder;
    }
    public Integer getFollowing() {
        return following;
    }
    public void setFollowing(Integer following) {
        this.following = following;
    }
    public Integer getIsEducate() {
        return isEducate;
    }
    public void setIsEducate(Integer isEducate) {
        this.isEducate = isEducate;
    }
    public Integer getOver() {
        return over;
    }
    public void setOver(Integer over) {
        this.over = over;
    }
    public String getReservationCode() {
        return reservationCode;
    }
    public void setReservationCode(String reservationCode) {
        this.reservationCode = reservationCode;
    }
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    public int getIsAgain() {
        return isAgain;
    }
    public void setIsAgain(int isAgain) {
        this.isAgain = isAgain;
    }
    public String getParentCode() {
        return parentCode;
    }
    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }
    public String getOriginCode() {
        return originCode;
    }
    public void setOriginCode(String originCode) {
        this.originCode = originCode;
    }
    public String getAdviceCode() {
        return adviceCode;
    }
    public void setAdviceCode(String adviceCode) {
        this.adviceCode = adviceCode;
    }
    public String getOtherAdvice() {
        return otherAdvice;
    }
    public void setOtherAdvice(String otherAdvice) {
        this.otherAdvice = otherAdvice;
    }
    public int getSource() {
        return source;
    }
    public void setSource(int source) {
        this.source = source;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getSex() {
        return sex;
    }
    public void setSex(String sex) {
        this.sex = sex;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
    public int getLevel() {
        return level;
    }
    public void setLevel(int level) {
        this.level = level;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
}

+ 85 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/specialist/SurveyTemplateQuestionsVo.java

@ -0,0 +1,85 @@
package com.yihu.jw.restmodel.specialist;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by Reece on 2018/7/8.
 */
public class SurveyTemplateQuestionsVo{
    @ApiModelProperty("问题编码")
    private String code;
    @ApiModelProperty("问题标题")
    private String title;
    @ApiModelProperty("问题说明(可为null)")
    private String questionComment;
    @ApiModelProperty("问题类型(0单选 1多选 2问答)")
    private Integer questionType;
    @ApiModelProperty("模板编码")
    private String templateCode;
    @ApiModelProperty("排序")
    private Integer sort;
    @ApiModelProperty("删除标志(1正常,0删除)")
    private Integer del;
    public SurveyTemplateQuestionsVo() {
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    public String getQuestionComment() {
        return questionComment;
    }
    public void setQuestionComment(String questionComment) {
        this.questionComment = questionComment;
    }
    public Integer getQuestionType() {
        return questionType;
    }
    public void setQuestionType(Integer questionType) {
        this.questionType = questionType;
    }
    public String getTemplateCode() {
        return templateCode;
    }
    public void setTemplateCode(String templateCode) {
        this.templateCode = templateCode;
    }
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 42 - 0
common/common-util/src/main/java/com/yihu/jw/util/common/IdCardUtil.java

@ -11,6 +11,13 @@ import java.util.Date;
 * 身份证工具类
 */
public class IdCardUtil {
    //二级维度的性别
    public static String level_sex_1="1";
    public static String level_sex_2="2";
    public static String level_sex_3="3";
    public static String level_sex_1_name="男";
    public static String level_sex_2_name="女";
    public static String level_sex_3_name="未知";
//    /**
@ -145,4 +152,39 @@ public class IdCardUtil {
        return false;
    }
    /**
     * 根据身份证的号码算出当前身份证持有者的性别
     * 1 男 2 女 3未知
     *
     * @return
     * @throws Exception
     */
    public static String getSexForIdcard_new(String CardCode)
            throws Exception {
        String sex = level_sex_3;
        try {
            if (CardCode.length() == 18) {
                if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
                    // modifid by lyr 2016-09-29
                    sex = level_sex_2;
                    // modifid by lyr 2016-09-29
                } else {
                    // modifid by lyr 2016-09-29
                    sex = level_sex_1;
                    // modifid by lyr 2016-09-29
                }
            } else if (CardCode.length() == 15) {
                String usex = CardCode.substring(14, 15);// 用户的性别
                if (Integer.parseInt(usex) % 2 == 0) {
                    sex = level_sex_2;
                } else {
                    sex = level_sex_1;
                }
            }
            return sex;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sex;
    }
}

+ 10 - 12
svr-lib-parent-pom/pom.xml

@ -58,8 +58,6 @@
        <version.spring-data-hadoop>2.3.0.RELEASE</version.spring-data-hadoop>
        <version.springside>4.2.3-GA</version.springside>
        <version.zipkin>1.24.0</version.zipkin>
        <version.hibernate>5.0.12.Final</version.hibernate>
        <version.hibernate-jpa>1.0.0.Final</version.hibernate-jpa>
        <version.servlet-api>3.1.0</version.servlet-api>
        <version.swagger>2.7.0</version.swagger>
        <version.swagger-ui>2.7.0</version.swagger-ui>
@ -258,16 +256,16 @@
                <classifier>GA</classifier>
            </dependency>
            <!--hibernate start-->
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>${version.hibernate}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate.javax.persistence</groupId>
                <artifactId>hibernate-jpa-2.1-api</artifactId>
                <version>${version.hibernate-jpa}</version>
            </dependency>
            <!--<dependency>-->
                <!--<groupId>org.hibernate</groupId>-->
                <!--<artifactId>hibernate-core</artifactId>-->
                <!--<version>${version.hibernate}</version>-->
            <!--</dependency>-->
            <!--<dependency>-->
                <!--<groupId>org.hibernate.javax.persistence</groupId>-->
                <!--<artifactId>hibernate-jpa-2.1-api</artifactId>-->
                <!--<version>${version.hibernate-jpa}</version>-->
            <!--</dependency>-->
            <!--hibernate end-->
            <!--fastdfs start-->

+ 2 - 1
svr/readme.MD

@ -5,4 +5,5 @@ svr 相关的db设计
    svr-wlyy i健康公共业务后台
    svr-iot 医疗物联网服务
    svr-manage 基卫后台管理系统   (独立的系统不注册到发现服务)
    svr-wlyy-archives 居民档案建立服务
    svr-wlyy-archives 居民档案建立服务
    svr-rehabilitation 居民康复计划

+ 6 - 3
svr/svr-base/src/main/java/com/yihu/jw/business/demo/DemoController.java

@ -2,6 +2,7 @@ package com.yihu.jw.business.demo;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.business.user.dao.BaseRoleDao;
import com.yihu.jw.exception.SystemException;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.fegin.DemoFeign;
@ -26,13 +27,15 @@ import javax.servlet.http.HttpServletRequest;
@Api(description = "demo例子")
@RefreshScope
public class DemoController {
    @Autowired
    private BaseRoleDao baseRoleDao;
    @ApiOperation(value = "根据code查找患者")
    @GetMapping(value = "findByCode")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "患者code", required = true) @RequestParam(value = "code", required = true) String code) {
        return  Envelop.getSuccess(code);
            @ApiParam(name = "code", value = "患者code", required = false) @RequestParam(value = "code", required = false) String code) {
        baseRoleDao.findAllByName("管理员");
        return  Envelop.getSuccess("成功");
    }
}

+ 0 - 69
svr/svr-base/src/main/java/com/yihu/jw/business/sms/controller/SMSController.java

@ -1,69 +0,0 @@
package com.yihu.jw.business.sms.controller;
import com.yihu.jw.base.sms.BaseSmsDO;
import com.yihu.jw.business.sms.service.SmsService;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.restmodel.base.sms.SmsVO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
import com.yihu.jw.rm.base.BaseSmsRequestMapping;
import com.yihu.jw.util.common.MobileUtils;
import com.yihu.jw.util.common.NetworkUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by chenweida on 2017/5/19.
 * 注册发送短信验证码
 */
@RestController
@RequestMapping(BaseSmsRequestMapping.api_common)
@Api(value = "短信模块", description = "短信模块接口管理")
public class SMSController extends EnvelopRestController {
    @Autowired
    private SmsService smsService;
    @ApiOperation(value = "(注册、找回密码)发送校验码")
    @PostMapping(value = BaseSmsRequestMapping.Sms.api_sms_send, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public BaseEnvelop send(@ApiParam(name = "mobile", value = "手机号码", required = true) @RequestParam(value = "mobile", required = true) String mobile,
                            @ApiParam(name = "type", value = "短信验证码类型", required = true) @RequestParam(value = "type", required = true) int type,
                            @ApiParam(name = "saasId", value = "saasId", required = true) @RequestParam(value = "saasId", required = true) String saasId,
                            HttpServletRequest request) throws IOException {
        try {
            if (type > 10 || type < 1) {
                return BaseEnvelop.getError("无效的请求!");
            }
            if (StringUtils.isEmpty(mobile)) {
                return BaseEnvelop.getError("手机号码不允许为空!");
            }
            if(!MobileUtils.checkCellphone(mobile)){
                return BaseEnvelop.getError("手机号码格式不正确!");
            }
            // 获取ip地址
            String ip = NetworkUtil.getIpAddress(request);
            if (StringUtils.isEmpty(ip)) {
                return  BaseEnvelop.getError("无效的ip请求!");
            }
            BaseEnvelop envelop1 = smsService.send(mobile,ip,type,saasId);
            return envelop1;
        } catch (Exception e) {
            error(e);
            return  BaseEnvelop.getError("手机号有误,无法发送验证!");
        }
    }
}

+ 10 - 4
svr/svr-base/src/main/java/com/yihu/jw/config/jpa/HibernateProperties.java

@ -1,9 +1,13 @@
package com.yihu.jw.config.jpa;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Properties;
/**
@ -20,17 +24,19 @@ public class HibernateProperties {
//    private String naming_strategy;
    @Value("${hibernate.physical_naming_strategy}")
    private String  physical_naming_strategy;
    private String physical_naming_strategy;
    @Value("${hibernate.implicit_naming_strategy}")
    private String implicit_naming_strategy;
    @Autowired
    private List<Interceptor> interceptors;
    public  Properties hibProperties() {
    public Properties hibProperties() {
        Properties properties = new Properties();
        properties.put("hibernate.dialect",dialect);
        properties.put("hibernate.dialect", dialect);
        properties.put("hibernate.show_sql", show_sql);
        properties.put("hibernate.physical_naming_strategy", physical_naming_strategy);
        properties.put("hibernate.implicit_naming_strategy", implicit_naming_strategy);
        properties.put("hibernate.ejb.interceptor", interceptors.get(0));
        return properties;
    }
}

+ 7 - 1
svr/svr-base/src/main/resources/application.yml

@ -37,7 +37,13 @@ yihu:
  admin:
    client:
      advice:
        sql: true
        http: true #默认true
        sql:
          hibernate: true ##默认false
          springJDBC: true ##默认false
      server:
        ip: 192.168.131.102
        port: 8082
---
spring:

+ 6 - 1
svr/svr-iot/pom.xml

@ -146,7 +146,7 @@
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>common-data-es-starter</artifactId>
            <version>1.0.1</version>
            <version>1.1.2</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
@ -163,6 +163,11 @@
            <artifactId>poi</artifactId>
            <version>3.15-beta1</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-entity-es</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
    <build>
        <finalName>svr-iot</finalName>

+ 5 - 7
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataInputService.java

@ -3,17 +3,15 @@ package com.yihu.iot.datainput.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.base.es.config.ElastricSearchHelper;
import com.yihu.base.es.config.model.SaveModel;
//import com.yihu.base.hbase.HBaseAdmin;
//import com.yihu.base.hbase.HBaseHelper;
import com.yihu.iot.datainput.enums.DataOperationTypeEnum;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.datainput.util.RowKeyUtils;
import com.yihu.iot.service.device.IotDeviceService;
import com.yihu.jw.iot.datainput.DataBodySignsDO;
import com.yihu.jw.iot.datainput.WeRunDataDO;
import com.yihu.jw.datainput.DataBodySignsDO;
import com.yihu.jw.datainput.WeRunDataDO;
import com.yihu.jw.iot.device.IotDeviceDO;
import com.yihu.jw.restmodel.iot.datainput.WeRunDataVO;
import com.yihu.jw.util.date.DateUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
@ -278,10 +276,10 @@ public class DataInputService {
            familyList.add(family);
        }
        DataBodySignsDO bodySignsDO = JSONObject.parseObject(jsonObject.toJSONString(),DataBodySignsDO.class);
        List<SaveModel> list = new ArrayList<>();
        list.add(bodySignsDO);
        JSONArray saveArray = new JSONArray();
        saveArray.add(bodySignsDO);
        //将数据存入es
        elastricSearchHelper.save(ConstantUtils.esIndex, ConstantUtils.esType, list);
        elastricSearchHelper.save(ConstantUtils.esIndex, ConstantUtils.esType, saveArray.toJSONString());
        /*try {
            boolean tableExists = hBaseAdmin.isTableExists(ConstantUtils.tableName);

+ 1 - 4
svr/svr-iot/src/main/java/com/yihu/iot/datainput/service/DataStandardConvertService.java

@ -1,17 +1,14 @@
package com.yihu.iot.datainput.service;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.datainput.enums.DataDeviceTypeEnum;
import com.yihu.iot.datainput.enums.DataOperationTypeEnum;
import com.yihu.iot.datainput.enums.DataTypeEnum;
import com.yihu.jw.iot.datainput.DataBodySignsDO;
import com.yihu.jw.datainput.DataBodySignsDO;
import com.yihu.jw.iot.datainput.DataStandardDO;
import com.yihu.jw.util.date.DateUtil;
import org.apache.http.client.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

+ 2 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/common/ElasticSearchQueryGenerator.java

@ -5,8 +5,8 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.iot.datainput.enums.DataTypeEnum;
import com.yihu.iot.datainput.service.DataStandardConvertService;
import com.yihu.jw.iot.datainput.Data;
import com.yihu.jw.iot.datainput.StepInfoDO;
import com.yihu.jw.datainput.Data;
import com.yihu.jw.datainput.StepInfoDO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
//import org.apache.hadoop.hbase.util.CollectionUtils;

+ 12 - 16
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -2,13 +2,12 @@ package com.yihu.iot.service.device;
import com.alibaba.fastjson.JSONObject;
import com.yihu.base.es.config.ElastricSearchHelper;
import com.yihu.base.es.config.model.SaveModel;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.iot.dao.device.IotPatientDeviceDao;
import com.yihu.iot.datainput.util.ConstantUtils;
import com.yihu.iot.service.common.ElasticSearchQueryGenerator;
import com.yihu.jw.device.LocationDataDO;
import com.yihu.jw.iot.device.IotPatientDeviceDO;
import com.yihu.jw.iot.device.LocationDataDO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
@ -22,10 +21,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * @author yeshijie on 2018/1/16.
@ -227,18 +223,18 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,I
     * @return
     */
    public boolean deleteLocationsByIdcardOrSn(String jsonData){
        List<SaveModel> saveModelList = new ArrayList<>();
        List<Map<String,Object>> idList = new ArrayList<>();
        SearchSourceBuilder queryStr = elasticSearchQueryGenerator.getQueryBuilder("",jsonData);
        JestResult esResult = elastricSearchHelper.search(ConstantUtils.deviceLocationIndex,ConstantUtils.deviceLocationType,queryStr.toString());
        List<LocationDataVO> resultList = getESResultBeanList(esResult);
        for(LocationDataVO locationDataVO : resultList){
            SaveModel saveModel = new SaveModel();
            saveModel.setId(locationDataVO.getId());
            saveModelList.add(saveModel);
                Map<String,Object> map = new HashMap<>();
                map.put("id",locationDataVO.getId());
                idList.add(map);
        }
        boolean bool = true;
        try {
            elastricSearchHelper.deleteData(ConstantUtils.deviceLocationIndex,ConstantUtils.deviceLocationType,saveModelList);
            elastricSearchHelper.delete(ConstantUtils.deviceLocationIndex,ConstantUtils.deviceLocationType,idList);
        }catch (Exception e){
            bool = false;
        }
@ -252,16 +248,16 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,I
     * @return
     */
    public boolean updateLocationsByIdcardOrSn(String jsonData){
        List<SaveModel> saveModelList = new ArrayList<>();
        List<Map<String,Object>> idList = new ArrayList<>();
        SearchSourceBuilder queryStr = elasticSearchQueryGenerator.getQueryBuilder("",jsonData);
        JestResult esResult = elastricSearchHelper.search(ConstantUtils.deviceLocationIndex,ConstantUtils.deviceLocationType,queryStr.toString());
        List<LocationDataVO> resultList = getESResultBeanList(esResult);
        for(LocationDataVO locationDataVO : resultList){
            SaveModel saveModel = new SaveModel();
            saveModel.setId(locationDataVO.getId());
            saveModelList.add(saveModel);
            Map<String,Object> map = new HashMap<>();
            map.put("_id",locationDataVO.getId());
            idList.add(map);
        }
        boolean bool = elastricSearchHelper.update(ConstantUtils.deviceLocationIndex,ConstantUtils.deviceLocationType,saveModelList);
        boolean bool = elastricSearchHelper.updateByMap(ConstantUtils.deviceLocationIndex,ConstantUtils.deviceLocationType,idList);
        return bool;
    }

+ 1 - 0
svr/svr-iot/src/main/resources/application.yml

@ -30,6 +30,7 @@ spring:
    elasticsearch: #ElasticsearchProperties
      cluster-name: jkzl #默认即为elasticsearch  集群名
      cluster-nodes: 172.19.103.45:9300,172.19.103.68:9300 #配置es节点信息,逗号分隔,如果没有指定,则启动ClientNode
      cluster-nodes-jest: http://172.19.103.45:9200,http://172.19.103.68:9200  #多个逗号分割
      local: false #是否本地连接
      properties: # Additional properties used to configure the client.
        enable: true

+ 1 - 0
svr/svr-rehabilitation/readme.MD

@ -0,0 +1 @@
svr-rehabilitation 康复计划

+ 3 - 1
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationInformationController.java

@ -13,6 +13,8 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import com.yihu.jw.rm.rehabilitation.RehabilitationRequestMapping;
import java.util.List;
/**
 * @author humingfen on 2018/4/25.
 */
@ -80,7 +82,7 @@ public class RehabilitationInformationController extends EnvelopRestController {
    public Envelop<RehabilitationInformationDO> findByPatientId(@ApiParam(name = "patientId", value = "patientId")
                                                           @RequestParam(value = "patientId", required = true) String patientId) {
        try {
            RehabilitationInformationDO informationDO = rehabilitationInformationService.findByPatientId(patientId);
            List<RehabilitationInformationDO> informationDO = rehabilitationInformationService.findByPatientId(patientId);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_find, informationDO);
        } catch (Exception e) {
            e.printStackTrace();

+ 18 - 3
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationPerformanceController.java

@ -12,6 +12,8 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * @author humingfen on 2018/5/2.
 */
@ -44,10 +46,10 @@ public class RehabilitationPerformanceController extends EnvelopRestController {
        }
    }
    @GetMapping(value = RehabilitationRequestMapping.Performance.api_create)
    @PostMapping(value = RehabilitationRequestMapping.Performance.api_create)
    @ApiOperation(value = "创建康复计划执行情况", notes = "创建康复计划执行情况")
    public Envelop<RehabilitationPerformanceDO> createPerformance(@ApiParam(name = "jsonData", value = "基本信息Json", defaultValue = "")
                                                            @RequestParam(value = "jsonData", required = false) String jsonData) {
                                                            @RequestBody String jsonData) {
        try {
            RehabilitationPerformanceDO performanceDO = toEntity(jsonData, RehabilitationPerformanceDO.class);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_create, performanceService.create(performanceDO));
@ -70,10 +72,23 @@ public class RehabilitationPerformanceController extends EnvelopRestController {
        }
    }
    @GetMapping(value = RehabilitationRequestMapping.Performance.findPerformanceByPatientId)
    @ApiOperation(value = "根据patientId查找康复计划执行情况", notes = "根据patientId查找康复计划执行情况")
    public Envelop<RehabilitationPerformanceDO> findByPatientId(@ApiParam(name = "patientId", value = "patientId")
                                                         @RequestParam(value = "patientId", required = true) String patientId) {
        try {
            List<RehabilitationPerformanceDO> performanceDO = performanceService.findByPatientId(patientId);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_find, performanceDO);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = RehabilitationRequestMapping.Performance.api_update)
    @ApiOperation(value = "修改康复计划执行情况", notes = "修改康复计划执行情况(记得传入修改id)")
    public Envelop updatePerformance(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                  @RequestParam(value = "jsonData", required = true)String jsonData) {
                                  @RequestBody String jsonData) {
        try {
            RehabilitationPerformanceDO PerformanceDO = toEntity(jsonData, RehabilitationPerformanceDO.class);
            performanceService.update(PerformanceDO);

+ 5 - 5
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationPlanningController.java

@ -24,7 +24,7 @@ public class RehabilitationPlanningController extends EnvelopRestController {
    @Autowired
    private RehabilitationPlanningService planningService;
    @Autowired
    private RehabilitationTreatmentProgramService TreatmentProgramService;
    private RehabilitationTreatmentProgramService treatmentProgramService;
    @GetMapping(value = RehabilitationRequestMapping.Planning.findPlanningPage)
    @ApiOperation(value = "分页查找康复计划", notes = "分页查找康复计划")
@ -51,10 +51,10 @@ public class RehabilitationPlanningController extends EnvelopRestController {
        }
    }
    @GetMapping(value = RehabilitationRequestMapping.Planning.api_create)
    @PostMapping(value = RehabilitationRequestMapping.Planning.api_create)
    @ApiOperation(value = "创建康复计划", notes = "创建康复计划")
    public Envelop<RehabilitationPlanningDO> createPlanning(@ApiParam(name = "jsonData", value = "基本信息Json", defaultValue = "")
                                                                            @RequestParam(value = "jsonData", required = false) String jsonData) {
                                                                @RequestBody String jsonData) {
        try {
            RehabilitationPlanningDO planningDO = toEntity(jsonData, RehabilitationPlanningDO.class);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_create, planningService.create(planningDO));
@ -82,7 +82,7 @@ public class RehabilitationPlanningController extends EnvelopRestController {
    public Envelop<RehabilitationPlanningDO> findTreatmentByProgramId(@ApiParam(name = "programId", value = "programId")
                                                      @RequestParam(value = "programId", required = true) String programId) {
        try {
            RehabilitationTreatmentProgramDO treatmentProgramDO = TreatmentProgramService.findById(programId);
            RehabilitationTreatmentProgramDO treatmentProgramDO = treatmentProgramService.findById(programId);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_find, treatmentProgramDO);
        } catch (Exception e) {
            e.printStackTrace();
@ -93,7 +93,7 @@ public class RehabilitationPlanningController extends EnvelopRestController {
    @PostMapping(value = RehabilitationRequestMapping.Planning.api_update)
    @ApiOperation(value = "修改治疗方案", notes = "修改治疗方案(记得传入修改id)")
    public Envelop updatePlanning(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                          @RequestParam(value = "jsonData", required = true)String jsonData) {
                                      @RequestBody String jsonData) {
        try {
            RehabilitationPlanningDO planningDO = toEntity(jsonData, RehabilitationPlanningDO.class);
            planningService.update(planningDO);

+ 4 - 4
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/controller/RehabilitationTreatmentProgramController.java

@ -48,10 +48,10 @@ public class RehabilitationTreatmentProgramController extends EnvelopRestControl
        }
    }
    @GetMapping(value = RehabilitationRequestMapping.TreatmentProgram.api_create)
    @PostMapping(value = RehabilitationRequestMapping.TreatmentProgram.api_create)
    @ApiOperation(value = "创建治疗方案", notes = "创建治疗方案")
    public Envelop<RehabilitationTreatmentProgramDO> createTreatmentProgram(@ApiParam(name = "jsonData", value = "方案基本信息Json", defaultValue = "")
                                                                         @RequestParam(value = "jsonData", required = false) String jsonData) {
                                                                         @RequestBody String jsonData) {
        try {
            RehabilitationTreatmentProgramDO infos = new ObjectMapper().readValue(jsonData, new TypeReference<RehabilitationTreatmentProgramDO>(){});
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_create, treatmentProgramService.create(infos));
@ -77,7 +77,7 @@ public class RehabilitationTreatmentProgramController extends EnvelopRestControl
    @PostMapping(value = RehabilitationRequestMapping.TreatmentProgram.api_update)
    @ApiOperation(value = "修改治疗方案", notes = "修改治疗方案(记得传入修改id)")
    public Envelop updateTreatmentProgram(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                                                  @RequestParam(value = "jsonData", required = true)String jsonData) {
                                              @RequestBody String jsonData) {
        try {
            RehabilitationTreatmentProgramDO treatmentProgramDO = toEntity(jsonData, RehabilitationTreatmentProgramDO.class);
            treatmentProgramService.update(treatmentProgramDO);
@ -91,7 +91,7 @@ public class RehabilitationTreatmentProgramController extends EnvelopRestControl
    @PostMapping(value = RehabilitationRequestMapping.TreatmentProgram.api_delete)
    @ApiOperation(value = "删除治疗方案", notes = "删除治疗方案")
    public Envelop delTreatmentProgram(@ApiParam(name = "id", value = "id")
                                                               @RequestParam(value = "id", required = true) String id) {
                                           @RequestParam(value = "id", required = true) String id) {
        try {
            treatmentProgramService.delete(id);
            return Envelop.getSuccess(RehabilitationRequestMapping.Common.message_success_delete);

+ 3 - 1
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationInformationDao.java

@ -5,6 +5,8 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface RehabilitationInformationDao extends PagingAndSortingRepository<RehabilitationInformationDO, String>,
        JpaSpecificationExecutor<RehabilitationInformationDO> {
@ -12,5 +14,5 @@ public interface RehabilitationInformationDao extends PagingAndSortingRepository
    RehabilitationInformationDO findById(String id);
    @Query("from RehabilitationInformationDO w where w.patientId =?1 order by dischargeTime desc")
    RehabilitationInformationDO findByPatientId(String patientId);
    List<RehabilitationInformationDO> findByPatientId(String patientId);
}

+ 5 - 0
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationPerformanceDao.java

@ -5,9 +5,14 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface RehabilitationPerformanceDao extends PagingAndSortingRepository<RehabilitationPerformanceDO, String>,
        JpaSpecificationExecutor<RehabilitationPerformanceDO> {
    @Query("from RehabilitationPerformanceDO w where w.id = ?1")
    RehabilitationPerformanceDO findById(String id);
    @Query("from RehabilitationPerformanceDO w where w.createUser = ?1")
    List<RehabilitationPerformanceDO> findByPatientId(String patientId);
}

+ 1 - 1
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/dao/RehabilitationPlanningDao.java

@ -8,6 +8,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface RehabilitationPlanningDao extends PagingAndSortingRepository<RehabilitationPlanningDO, String>,
        JpaSpecificationExecutor<RehabilitationPlanningDO> {
    @Query("from RehabilitationPlanningDO w where w.id = ?1")
    @Query("from RehabilitationPlanningDO w where w.id = ?1 and w.status = 0")
    RehabilitationPlanningDO findById(String id);
}

+ 5 - 5
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationInformationService.java

@ -42,9 +42,9 @@ public class RehabilitationInformationService extends BaseJpaService<Rehabilitat
        StringBuffer sqlCount = new StringBuffer("SELECT COUNT(DISTINCT w.id) count from rehabilitation_information w where 1 = 1 ");
        List<Object> args = new ArrayList<>();
        if(StringUtils.isNotBlank(patientId)){
            sql.append(" and w.patientId = ? ");
            sqlCount.append(" and w.patientId = '%").append(patientId).append("%' ");
            args.add('%'+ patientId + '%');
            sql.append(" and w.patient_id = ? ");
            sqlCount.append(" and w.patient_id = '").append(patientId).append("' ");
            args.add(patientId);
        }
        if(StringUtils.isNotBlank(hospital)){
            sql.append(" and w.hospital like ? ");
@ -89,8 +89,8 @@ public class RehabilitationInformationService extends BaseJpaService<Rehabilitat
     * @param patientId
     * @return
     */
    public RehabilitationInformationDO findByPatientId(String patientId) {
        RehabilitationInformationDO informationDO = rehabilitationInformationDao.findByPatientId(patientId);
    public List<RehabilitationInformationDO> findByPatientId(String patientId) {
        List<RehabilitationInformationDO> informationDO = rehabilitationInformationDao.findByPatientId(patientId);
        return informationDO;
    }

+ 10 - 0
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPerformanceService.java

@ -62,6 +62,16 @@ public class RehabilitationPerformanceService extends BaseJpaService<Rehabilitat
        return performanceDO;
    }
    /**
     * 根据居民id查找康复计划执行情况
     * @param patientId
     * @return
     */
    public List<RehabilitationPerformanceDO> findByPatientId(String patientId) {
        List<RehabilitationPerformanceDO> performanceDO = performanceDao.findByPatientId(patientId);
        return performanceDO;
    }
    /**
     * 修改
     * @param performanceDO

+ 6 - 5
svr/svr-rehabilitation/src/main/java/com/yihu/rehabilitation/service/RehabilitationPlanningService.java

@ -30,7 +30,7 @@ public class RehabilitationPlanningService extends BaseJpaService<Rehabilitation
     * @throws ParseException
     */
    public Envelop<RehabilitationPlanningVO> queryPlanningPage(Integer page, Integer size, String patientId, String programId) throws ParseException {
        String filters = "";
        String filters = "status=0;";
        String semicolon = "";
        if(StringUtils.isNotBlank(patientId)){
            filters = "patientId="+patientId+"";
@ -52,10 +52,11 @@ public class RehabilitationPlanningService extends BaseJpaService<Rehabilitation
        return Envelop.getSuccessListWithPage(RehabilitationRequestMapping.Common.message_success_find_functions,planningVOs, page, size,count);
    }
    public RehabilitationPlanningDO create(RehabilitationPlanningDO PlanningDO) {
        PlanningDO.setSaasId(getCode());
        PlanningDO = planningDao.save(PlanningDO);
        return PlanningDO;
    public RehabilitationPlanningDO create(RehabilitationPlanningDO planningDO) {
        planningDO.setSaasId(getCode());
        planningDO.setStatus(0);
        planningDO = planningDao.save(planningDO);
        return planningDO;
    }
    public RehabilitationPlanningDO findById(String id) {

+ 6 - 0
svr/svr-wlyy-health-bank/pom.xml

@ -107,6 +107,12 @@
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-starter-config</artifactId>
        </dependency>
        <!-- redis start  -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <!-- redis end  -->
        <dependency>
            <groupId>com.sun.jna</groupId>
            <artifactId>jna</artifactId>

+ 3 - 0
svr/svr-wlyy-health-bank/src/main/java/META-INF/MANIFEST.MF

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Main-Class: com.yihu.jw.SvrWlyyHealthBankApplication

+ 9 - 3
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/config/jpa/HibernateProperties.java

@ -16,14 +16,20 @@ public class HibernateProperties {
    private String dialect;
    @Value("${hibernate.show_sql}")
    private String show_sql;
    @Value("${hibernate.ejb.naming_strategy}")
    private String naming_strategy;
//    @Value("${hibernate.ejb.naming_strategy}")
//    private String naming_strategy;
    @Value("${hibernate.physical_naming_strategy}")
    private String physical_naming_strategy;
    @Value("${hibernate.implicit_naming_strategy}")
    private String implicit_naming_strategy;
    public  Properties hibProperties() {
        Properties properties = new Properties();
        properties.put("hibernate.dialect",dialect);
        properties.put("hibernate.show_sql", show_sql);
        properties.put("hibernate.ejb.naming_strategy", naming_strategy);
//        properties.put("hibernate.ejb.naming_strategy", naming_strategy);
        properties.put("hibernate.physical_naming_strategy", physical_naming_strategy);
        properties.put("hibernate.implicit_naming_strategy", implicit_naming_strategy);
        return properties;
    }
}

+ 57 - 4
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/AccountController.java

@ -2,6 +2,8 @@ package com.yihu.jw.controller;/**
 * Created by nature of king on 2018/5/10.
 */
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.health.bank.AccountDO;
import com.yihu.jw.entity.health.bank.CreditsDetailDO;
import com.yihu.jw.restmodel.common.Envelop;
@ -14,10 +16,10 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * @author wangzhinan
@ -79,6 +81,32 @@ public class AccountController extends EnvelopRestController {
        }
    }
    /**
     *  获取银行账户
     *
     * @param account 银行账户对象
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.findAccount)
    @ApiOperation(value = "获取银行账户信息")
    public Envelop<AccountDO> select(@ApiParam(name = "account",value = "账户JSON")
                                     @RequestParam(value = "account",required = false)String account,
                                     @ApiParam(name = "page", value = "第几页,从1开始")
                                     @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                     @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                     @RequestParam(value = "size", required = false)Integer size){
        try{
            AccountDO accountDO = toEntity(account,AccountDO.class);
            return service.findByCondition(accountDO,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 查看银行账户信息
@ -106,4 +134,29 @@ public class AccountController extends EnvelopRestController {
        }
    }*/
    /**
     * 筛选用户
     * @param object
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.findAccounByCondition)
    @ApiOperation(value = "按条件获取用户信息")
    public Envelop<AccountDO> select(@RequestBody JSONObject object){
        try{
            JSONArray patientIds = object.getJSONArray("patients");
            JSONArray deviceTypes = object.getJSONArray("deviceTypes");
            int bindStatus = object.getInteger("bindStatus");
            String ruleId = object.getString("ruleId");
            Integer page = object.getInteger("page");
            Integer size = object.getInteger("size");
            List<String> deviceTypes1 = new ArrayList<>();
            return service.findByCondition1(patientIds,ruleId,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 57 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/ActiveRecordController.java

@ -0,0 +1,57 @@
package com.yihu.jw.controller;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.health.bank.ActiveRecordDO;
import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.service.ActiveRecordService;
import com.yihu.jw.service.TaskPatientDtailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by 刘文彬 on 2018/6/12.
 */
@RestController
@RequestMapping(HealthBankMapping.api_health_bank_common)
@Api(tags = "健康银行活动活跃记录",description = "健康银行活动活跃记录")
public class ActiveRecordController extends EnvelopRestController {
    @Autowired
    private ActiveRecordService activeRecordService;
    @Autowired
    private TaskPatientDtailService taskPatientDtailService;
    @PostMapping(value = HealthBankMapping.healthBank.createActiveRecord)
    @ApiOperation(value = "添加健康银行活动活跃记录")
    public Envelop<ActiveRecordDO> addActiveRecord(@RequestBody JSONObject object){
        try{
            String openId = object.getString("patientOpenid");
            String idCard = object.getString("patientIdcard");
            String unionId = object.getString("unionId");
            String taskCode = object.getString("taskCode");
            Integer originalStatus = object.getInteger("originalStatus");
            Integer currentStatus = object.getInteger("currentStatus");
            String patientId = object.getString("patientId");
            TaskPatientDetailDO taskPatientDetailDO = taskPatientDtailService.selectByPatientId(openId,idCard,unionId,taskCode);
            if (taskPatientDetailDO == null){
                return Envelop.getError("尚未报名!");
            }else {
                ActiveRecordDO activeRecordDO = activeRecordService.insert(taskPatientDetailDO.getSaasId(),taskPatientDetailDO.getTaskId(),taskPatientDetailDO.getActivityId(),originalStatus,currentStatus,patientId);
                if(activeRecordDO!=null){
                    return Envelop.getSuccess("添加成功",activeRecordDO);
                }else{
                    return Envelop.getError("添加失败");
                }
            }
        }catch (Exception e){
            return Envelop.getError("添加失败");
        }
    }
}

+ 64 - 1
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/ActivityController.java

@ -2,6 +2,7 @@ package com.yihu.jw.controller;/**
 * Created by nature of king on 2018/4/27.
 */
import com.alibaba.fastjson.JSONArray;
import com.yihu.jw.entity.health.bank.ActivityDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
@ -12,7 +13,13 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * @author wangzhinan
@ -96,4 +103,60 @@ public class ActivityController extends EnvelopRestController{
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 查看参与的活动
     *
     * @param activity 活动对象
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.selectByPatient)
    @ApiOperation(value = "参与的活动")
    public Envelop<ActivityDO> selectByPatient(@ApiParam(name = "activity",value = "健康活动JSON")
                                           @RequestParam(value = "activity",required = false)String activity,
                                           @ApiParam(name = "page", value = "第几页,从1开始")
                                           @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                           @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                           @RequestParam(value = "size", required = false)Integer size){
        try{
            ActivityDO activityDO = toEntity(activity,ActivityDO.class);
            return service.selectByPatient(activityDO,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 批量删除数据
     *
     * @param ids id集合[""]
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.batchActivity)
    @ApiOperation(value = "批量删除活动")
    public Envelop<Boolean> batchDelete(@ApiParam(name="ids",value = "id集合")
                                        @RequestParam(value = "ids",required = false)String ids){
        try{
            Envelop<Boolean> envelop = new Envelop<>();
            JSONArray array = JSONArray.parseArray(ids);
            List<String> activityIds = new ArrayList<>();
            for (int i = 0;i<array.size();i++){
                activityIds.add(array.getString(i));
            }
            service.batchDelete(activityIds);
            envelop.setObj(true);
            return envelop;
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 0 - 95
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/ActivityDetailController.java

@ -1,95 +0,0 @@
package com.yihu.jw.controller;/**
 * Created by nature of king on 2018/4/27.
 */
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.service.ActivityRuleService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author wangzhinan
 * @create 2018-04-27 15:24
 * @desc health activity info controller
 **/
@RestController
@RequestMapping(HealthBankMapping.api_health_bank_common)
@Api(tags = "健康活动参与情况相关操作",description = "健康活动参与情况相关操作")
public class ActivityDetailController extends EnvelopRestController {
    @Autowired
    private ActivityRuleService service;
    @Autowired
    private Tracer tracer;
/*
    *//**
     * patient attend activity
     *
     * @param activityInfo
     * @return
     *//*
    @PostMapping(value = HealthBankMapping.healthBank.createActivityInfo)
    @ApiOperation(value = "参与活动")
    public Envelop<Boolean> attendActivity(@ApiParam(name = "activityInfo",value = "健康活动详情JSON")
                                            @RequestParam(value = "activityInfo",required = true)String activityInfo){
        try {
            ActivityRuleDO activityRuleDO = toEntity(activityInfo,ActivityRuleDO.class);
            return service.insert(activityRuleDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    *//**
     * find health activity
     *
     * @param activityInfo
     * @param page
     * @param size
     * @return
     *//*
    @PostMapping(value = HealthBankMapping.healthBank.findActivityInfo)
    @ApiOperation(value = "查看健康活动")
    public Envelop<ActivityRuleDO> getActivityInfo(@ApiParam(name = "activityInfo",value = "健康活动JSON")
                                                @RequestParam(value = "activityInfo",required = false)String activityInfo,
                                                   @ApiParam(name = "page", value = "第几页,从1开始")
                                                @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                                   @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                                @RequestParam(value = "size", required = false)Integer size){
        try{
            ActivityRuleDO activityRuleDO = toEntity(activityInfo,ActivityRuleDO.class);
            return service.findByCondition(activityRuleDO,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    *//**
     * patient update activity status
     *
     * @param activityInfo
     * @return
     *//*
    @PostMapping(value = HealthBankMapping.healthBank.updateActivityInfo)
    @ApiOperation(value = "更新活动状态")
    public Envelop<Boolean> updateActivity(@ApiParam(name = "activityInfo",value = "健康活动JSON")
                                        @RequestParam(value = "activityInfo",required = true)String activityInfo){
        try {
            ActivityRuleDO activityRuleDO = toEntity(activityInfo,ActivityRuleDO.class);
            return service.update(activityRuleDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }*/
}

+ 125 - 2
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/CreditsDetailController.java

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.health.bank.AccountDO;
import com.yihu.jw.entity.health.bank.CreditsDetailDO;
import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
@ -13,6 +14,7 @@ import com.yihu.jw.service.CreditsDetailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import javafx.beans.binding.BooleanExpression;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.*;
@ -47,9 +49,9 @@ public class CreditsDetailController extends EnvelopRestController {
    @ApiOperation(value = "查看积分记录")
    public Envelop<CreditsDetailDO> selectCreditsLogInfo(@ApiParam(name = "creditsDetail",value = "积分记录JSON")
                                                          @RequestParam(value = "creditsDetail",required = false)String creditsDetail,
                                                            @ApiParam(name = "page", value = "第几页,从1开始")
                                                         @ApiParam(name = "page", value = "第几页,从1开始")
                                                          @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                                            @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                                         @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                                          @RequestParam(value = "size", required = false)Integer size){
        try{
            CreditsDetailDO creditsDetailDO = toEntity(creditsDetail,CreditsDetailDO.class);
@ -62,6 +64,7 @@ public class CreditsDetailController extends EnvelopRestController {
    }
    /**
     * 添加积分
     *
@ -82,6 +85,39 @@ public class CreditsDetailController extends EnvelopRestController {
        }
    }
    /**
     * 根据活动查找积分
     *
     * @param activityId 活动id
     *
     * @param patientId 居民id
     *
     * @param page 页码
     *
     * @param size 分页大小
     *
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.selectByActivity)
    @ApiOperation(value = "根据活动查找积分")
    public Envelop<CreditsDetailDO> seletcByActivity(@ApiParam(name = "activityId",value = "活动id")
                                                         @RequestParam(value = "activityId",required = true)String activityId,
                                                         @ApiParam(name = "patientId",value = "居民id")
                                                         @RequestParam(value = "patientId",required = true) String patientId,
                                                         @ApiParam(name = "page", value = "第几页,从1开始")
                                                         @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                                         @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                                         @RequestParam(value = "size", required = false)Integer size){
        try{
            return service.selectByActivity(activityId,patientId,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 查看积分排行
     *
@ -107,5 +143,92 @@ public class CreditsDetailController extends EnvelopRestController {
        }
    }
    /**
     * 活动排名
     * @param object
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.selectByActivityRanking)
    @ApiOperation(value = "活动排名")
    public Envelop<TaskPatientDetailDO> selectByActivityRanking(@RequestBody JSONObject object){
        try{
            JSONArray array = object.getJSONArray("filter");
            String activityId = object.getString("activityId");
            Integer page = object.getInteger("page");
            Integer size = object.getInteger("size");
            List<String> ids = new ArrayList<>();
            for (int i=0;array != null && array.size()!=0&& i<array.size();i++){
                ids.add(array.getString(i));
            }
            return service.selectByActivityRanking(activityId,ids,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 根据活动id查找全部活动
     *
     * @param activityId 活动ID
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.selectByActivityRanking1)
    @ApiOperation(value = "根据活动id查找全部排行")
    public Envelop<TaskPatientDetailDO> selectByActivityRanking1(@ApiParam(name = "activityId",value = "活动id")
                                                     @RequestParam(value = "activityId",required = true)String activityId,
                                                     @ApiParam(name = "patientId",value = "居民id")
                                                     @RequestParam(value = "patientId",required = true)String patientId,
                                                     @ApiParam(name = "page", value = "第几页,从1开始")
                                                     @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                                     @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                                     @RequestParam(value = "size", required = false)Integer size){
        try{
            return service.selectByActivityRanking1(activityId,patientId,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = HealthBankMapping.healthBank.doctorAddIntegrate)
    @ApiOperation(value = "添加积分记录")
    public Envelop<Boolean> doctorAddIntegrate(@RequestBody JSONObject object){
        try {
            JSONArray array = object.getJSONArray("patient");
            String ruleId = object.getString("ruleId");
            String description = object.getString("description");
            return service.doctorAddIntegrate(array,ruleId,description);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 步数获取积分
     *
     * @param creditsDetail 积分对象
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.addStepIntegrate)
    @ApiOperation(value = "步数获取积分")
    public Envelop<CreditsDetailDO> addStepIntegrate(@ApiParam(name = "creditsDetail",value = "积分记录JSON")
                                                 @RequestParam(value = "creditsDetail",required = true)String creditsDetail){
        try {
            CreditsDetailDO creditsDetailDO = toEntity(creditsDetail,CreditsDetailDO.class);
            return service.stepAddIntegrate(creditsDetailDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 77 - 6
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskController.java

@ -2,6 +2,8 @@ package com.yihu.jw.controller;/**
 * Created by nature of king on 2018/4/27.
 */
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.entity.health.bank.TaskDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
@ -12,10 +14,10 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * @author wangzhinan
@ -78,6 +80,75 @@ public class TaskController extends EnvelopRestController {
        }
    }
    /**
     * 根据编码查询
     *
     * @param object
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.selectByCode)
    @ApiOperation(value = "根据编码查询")
    public Envelop<TaskDO> selectByCode(@RequestBody JSONObject object){
        try {
            JSONArray array = object.getJSONArray("taskCode");
            String patientId = object.getString("patientId");
            Integer page = object.getInteger("page");
            Integer size = object.getInteger("size");
            return service.selectByTask(array,patientId,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 更新任务
     *
     * @param task 任务对象
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.updateTask)
    @ApiOperation(value = "更新任务")
    public Envelop<Boolean> udpateTask(@ApiParam(name = "task",value = "健康任务JSON")
                                          @RequestParam(value = "task",required = true)String task){
        try {
            TaskDO taskDO = toEntity(task,TaskDO.class);
            return service.update(taskDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 删除任务
     *
     * @param ids id集合[]
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.batchTask)
    @ApiOperation(value = "批量删除任务")
    public Envelop<Boolean> batchDelete(@ApiParam(name="ids",value = "id集合[]")
                                        @RequestParam(value = "ids",required = false)String ids){
        try{
            Envelop<Boolean> envelop = new Envelop<>();
            JSONArray array = JSONArray.parseArray(ids);
            List<String> taskIds = new ArrayList<>();
            for (int i = 0;i<array.size();i++){
                taskIds.add(array.getString(i));
            }
            service.batchDelete(taskIds);
            envelop.setObj(true);
            return envelop;
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**//**
@ -90,7 +161,7 @@ public class TaskController extends EnvelopRestController {
     *//*
    @GetMapping(value = HealthBankMapping.healthBank.findTask)
    @ApiOperation(value = "查看健康任务")
    public Envelop<TaskDetailDO> getTaskByPatient(@ApiParam(name = "patientId",value = "居民Id")
    public Envelop<TaskPatientDetailDO> getTaskByPatient(@ApiParam(name = "patientId",value = "居民Id")
                                                @RequestParam(value = "patientId",required = false)String patientId,
                                                  @ApiParam(name = "doctorId",value = "家庭医生Id")
                                                @RequestParam(value = "doctorId",required = false)String doctorId,
@ -112,7 +183,7 @@ public class TaskController extends EnvelopRestController {
    public Envelop<Boolean> updateTask(@ApiParam(name = "taskInfo",value = "健康任务JSON")
                                                @RequestParam(value = "taskInfo",required = true)String taskInfo){
        try{
            TaskDetailDO taskDetailDO = toEntity(taskInfo,TaskDetailDO.class);
            TaskPatientDetailDO taskDetailDO = toEntity(taskInfo,TaskPatientDetailDO.class);
            return service.update(taskDetailDO);
        }catch (Exception e){
            e.printStackTrace();

+ 5 - 5
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskDetailController.java

@ -2,7 +2,7 @@ package com.yihu.jw.controller;/**
 * Created by nature of king on 2018/4/27.
 */
import com.yihu.jw.entity.health.bank.TaskDetailDO;
import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
@ -42,8 +42,8 @@ public class TaskDetailController extends EnvelopRestController {
    public Envelop<Boolean> assigningTask(@ApiParam(name = "taskDetail",value = "健康任务JSON")
                                          @RequestParam(value = "taskDetail",required = true)String taskDetail){
        try {
            TaskDetailDO taskDetailDO = toEntity(taskDetail,TaskDetailDO.class);
            return service.insert(taskDetailDO);
            TaskPatientDetailDO taskPatientDetailDO = toEntity(taskDetail,TaskPatientDetailDO.class);
            return service.insert(taskPatientDetailDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
@ -62,7 +62,7 @@ public class TaskDetailController extends EnvelopRestController {
     *//*
    @GetMapping(value = HealthBankMapping.healthBank.findTask)
    @ApiOperation(value = "查看健康任务")
    public Envelop<TaskDetailDO> getTaskByPatient(@ApiParam(name = "patientId",value = "居民Id")
    public Envelop<TaskPatientDetailDO> getTaskByPatient(@ApiParam(name = "patientId",value = "居民Id")
                                                @RequestParam(value = "patientId",required = false)String patientId,
                                                  @ApiParam(name = "doctorId",value = "家庭医生Id")
                                                @RequestParam(value = "doctorId",required = false)String doctorId,
@ -84,7 +84,7 @@ public class TaskDetailController extends EnvelopRestController {
    public Envelop<Boolean> updateTask(@ApiParam(name = "taskInfo",value = "健康任务JSON")
                                                @RequestParam(value = "taskInfo",required = true)String taskInfo){
        try{
            TaskDetailDO taskDetailDO = toEntity(taskInfo,TaskDetailDO.class);
            TaskPatientDetailDO taskDetailDO = toEntity(taskInfo,TaskPatientDetailDO.class);
            return service.update(taskDetailDO);
        }catch (Exception e){
            e.printStackTrace();

+ 100 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskDictController.java

@ -0,0 +1,100 @@
package com.yihu.jw.controller;/**
 * Created by nature of king on 2018/6/8.
 */
import com.yihu.jw.entity.health.bank.TaskDictDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.service.TaskDictService;
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.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author wangzhinan
 * @create 2018-06-08 16:42
 * @desc 任务字典 Controller
 **/
@RestController
@RequestMapping(HealthBankMapping.api_health_bank_common)
@Api(tags = "健康任务字典相关操作",description = "健康任务字典相关操作")
public class TaskDictController extends EnvelopRestController {
    @Autowired
    private TaskDictService service;
    @Autowired
    private Tracer tracer;
    /**
     * 添加任务字典
     *
     * @param taskDict 任务字典对象
     *
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.createTaskDict)
    @ApiOperation(value = "添加任务字典")
    public Envelop<Boolean> insert(@ApiParam(name = "taskDict",value = "任务字典JSON")
                                       @RequestParam(value = "taskDict",required = true)String taskDict){
        try {
            TaskDictDO taskDictDO = toEntity(taskDict,TaskDictDO.class);
            return service.insert(taskDictDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 更新任务字典
     * @param taskDict 更新任务字典
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.updateTaskDict)
    @ApiOperation(value = "更新任务字典")
    public Envelop<Boolean> update(@ApiParam(name = "taskDict",value = "任务字典JSON")
                                   @RequestParam(value = "taskDict",required = true)String taskDict){
        try {
            TaskDictDO taskDictDO = toEntity(taskDict,TaskDictDO.class);
            return service.update(taskDictDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 查询任务字典
     *
     * @param taskDict 任务字典对象
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.findTaskDict)
    @ApiOperation(value = "查询任务字典")
    public Envelop<TaskDictDO> select(@ApiParam(name = "taskDict",value = "任务字典JSON")
                                      @RequestParam(value = "taskDict",required = true)String taskDict,
                                      @ApiParam(name = "page", value = "第几页,从1开始")
                                      @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                      @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                      @RequestParam(value = "size", required = false)Integer size){
        try {
            TaskDictDO taskDictDO = toEntity(taskDict,TaskDictDO.class);
            return service.selectByCondition(taskDictDO,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 102 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskGoodsController.java

@ -0,0 +1,102 @@
package com.yihu.jw.controller;/**
 * Created by nature of king on 2018/6/8.
 */
import com.yihu.jw.entity.health.bank.TaskGoodsDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.service.TaskGoodsService;
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.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author wangzhinan
 * @create 2018-06-08 16:52
 * @desc 任务商品
 **/
@RestController
@RequestMapping(HealthBankMapping.api_health_bank_common)
@Api(tags = "健康任务商品相关操作",description = "健康任务商品相关操作")
public class TaskGoodsController extends EnvelopRestController {
    @Autowired
    private TaskGoodsService service;
    @Autowired
    private Tracer tracer;
    /**
     * 更新任务商品
     *
     * @param taskGoods 任务商品对象
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.createTaskGoods)
    @ApiOperation(value = "添加任务商品")
    public Envelop<Boolean> insert(@ApiParam(name = "taskGoods",value = "任务商品JSON")
                                   @RequestParam(value = "taskGoods",required = true)String taskGoods){
        try {
            TaskGoodsDO taskGoodsDO = toEntity(taskGoods,TaskGoodsDO.class);
            return service.insert(taskGoodsDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 更新任务商品
     *
     * @param taskGoods 任务商品
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.updateTaskGoods)
    @ApiOperation(value = "更新任务商品")
    public Envelop<Boolean> update(@ApiParam(name = "taskGoods",value = "任务商品JSON")
                                   @RequestParam(value = "taskGoods",required = true)String taskGoods){
        try {
            TaskGoodsDO taskGoodsDO = toEntity(taskGoods,TaskGoodsDO.class);
            return service.update(taskGoodsDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 查询任务商品
     *
     * @param taskGoods 任务商品对象
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.findTaskGoods)
    @ApiOperation(value = "查询任务商品")
    public Envelop<TaskGoodsDO> select(@ApiParam(name = "taskGoods",value = "任务商品JSON")
                                      @RequestParam(value = "taskGoods",required = true)String taskGoods,
                                  @ApiParam(name = "page", value = "第几页,从1开始")
                                      @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                  @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                      @RequestParam(value = "size", required = false)Integer size){
        try {
            TaskGoodsDO taskGoodsDO = toEntity(taskGoods,TaskGoodsDO.class);
            return service.selectByCondition(taskGoodsDO,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 56 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskPatientDetailController.java

@ -0,0 +1,56 @@
package com.yihu.jw.controller;/**
 * Created by nature of king on 2018/6/11.
 */
import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.service.TaskPatientDtailService;
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.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author wangzhinan
 * @create 2018-06-11 10:37
 * @desc 活动参与表
 **/
@RestController
@RequestMapping(HealthBankMapping.api_health_bank_common)
@Api(tags = "健康任务参与详情",description = "健康任务参与详情")
public class TaskPatientDetailController extends EnvelopRestController {
    @Autowired
    private TaskPatientDtailService service;
    @Autowired
    private Tracer tracer;
    /**
     * 参与活动
     *
     * @param taskPatientDetail 参与活动详情对象
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.attendTask)
    @ApiOperation(value = "参与活动")
    public Envelop<Boolean> insert(@ApiParam(name = "taskPatientDetail",value = "参与活动JSON")
                                   @RequestParam(value = "taskPatientDetail",required = true)String taskPatientDetail){
        try {
            TaskPatientDetailDO taskPatientDetailDO = toEntity(taskPatientDetail, TaskPatientDetailDO.class);
            return service.insert(taskPatientDetailDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 102 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskRangController.java

@ -0,0 +1,102 @@
package com.yihu.jw.controller;/**
 * Created by nature of king on 2018/6/8.
 */
import com.yihu.jw.entity.health.bank.TaskRangDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.service.TaskRangService;
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.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author wangzhinan
 * @create 2018-06-08 17:02
 * @desc 任务范围
 **/
@RestController
@RequestMapping(HealthBankMapping.api_health_bank_common)
@Api(tags = "健康任务范围相关操作",description = "健康任务范围相关操作")
public class TaskRangController extends EnvelopRestController {
    @Autowired
    private TaskRangService service;
    @Autowired
    private Tracer tracer;
    /**
     * 添加任务范围
     *
     * @param taskRang 任务范围对象
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.createTaskRang)
    @ApiOperation(value = "添加任务范围")
    public Envelop<Boolean> insert(@ApiParam(name = "taskRang",value = "任务范围JSON")
                                   @RequestParam(value = "taskRang",required = true)String taskRang){
        try {
            TaskRangDO taskRangDO = toEntity(taskRang,TaskRangDO.class);
            return service.insert(taskRangDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 更新任务范围
     *
     * @param taskRang 任务范围对象
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.updateTaskRang)
    @ApiOperation(value = "更新任务范围")
    public Envelop<Boolean> update(@ApiParam(name = "taskRang",value = "任务范围JSON")
                                   @RequestParam(value = "taskRang",required = true)String taskRang){
        try {
            TaskRangDO taskRangDO = toEntity(taskRang,TaskRangDO.class);
            return service.update(taskRangDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 查看任务范围
     *
     * @param taskRang 任务范围对象
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.findTaskRang)
    @ApiOperation(value = "查询任务范围")
    public Envelop<TaskRangDO> select(@ApiParam(name = "taskRang",value = "任务范围JSON")
                                      @RequestParam(value = "taskRang",required = true)String taskRang,
                                      @ApiParam(name = "page", value = "第几页,从1开始")
                                      @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                      @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                      @RequestParam(value = "size", required = false)Integer size){
        try {
            TaskRangDO taskRangDO = toEntity(taskRang,TaskRangDO.class);
            return service.selectByCondition(taskRangDO,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 135 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/controller/TaskRuleController.java

@ -0,0 +1,135 @@
package com.yihu.jw.controller;/**
 * Created by nature of king on 2018/6/8.
 */
import com.alibaba.fastjson.JSONArray;
import com.yihu.jw.entity.health.bank.TaskRuleDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.service.TaskRuleService;
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.cloud.sleuth.Tracer;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * @author wangzhinan
 * @create 2018-06-08 16:25
 * @desc 任务规则 controller
 **/
@RestController
@RequestMapping(HealthBankMapping.api_health_bank_common)
@Api(tags = "健康任务规则相关操作",description = "健康任务规则相关操作")
public class TaskRuleController extends EnvelopRestController {
    @Autowired
    private TaskRuleService service;
    @Autowired
    private Tracer tracer;
    /**
     * 添加任务规则
     *
     * @param taskRule 任务规则对象
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.createTaskRule)
    @ApiOperation(value = "添加任务规则")
    public Envelop<Boolean> insert(@ApiParam(name = "taskRule",value = "健康任务规则JSON")
                                          @RequestParam(value = "taskRule",required = true)String taskRule){
        try {
            TaskRuleDO taskRuleDO = toEntity(taskRule,TaskRuleDO.class);
            return service.insert(taskRuleDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 更新任务规则
     *
     * @param taskRule 任务规则对象
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.updateTaskRule)
    @ApiOperation(value = "更新任务规则")
    public Envelop<Boolean> update(@ApiParam(name = "taskRule",value = "健康任务规则JSON")
                                          @RequestParam(value = "taskRule",required = true)String taskRule){
        try {
            TaskRuleDO taskRuleDO = toEntity(taskRule,TaskRuleDO.class);
            return service.update(taskRuleDO);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 查看任务规则
     *
     * @param taskRule 任务规则对象
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.findTaskRule)
    @ApiOperation(value = "查询任务规则")
    public Envelop<TaskRuleDO> select(@ApiParam(name = "taskRule",value = "健康任务规则JSON")
                                         @RequestParam(value = "taskRule",required = true)String taskRule,
                                         @ApiParam(name = "page", value = "第几页,从1开始")
                                         @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                         @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                         @RequestParam(value = "size", required = false)Integer size){
        try {
            TaskRuleDO taskRuleDO = toEntity(taskRule,TaskRuleDO.class);
            return service.selectByCondition(taskRuleDO,page,size);
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
    /**
     * 批量删除任务规则
     *
     * @param ids []
     * @return
     */
    @PostMapping(value = HealthBankMapping.healthBank.batchTaskRule)
    @ApiOperation(value = "批量删除任务规则")
    public Envelop<Boolean> batchDelete(@ApiParam(name="ids",value = "id集合[]")
                                        @RequestParam(value = "ids",required = false)String ids){
        try{
            Envelop<Boolean> envelop = new Envelop<>();
            JSONArray array = JSONArray.parseArray(ids);
            List<String> taskRuleIds = new ArrayList<>();
            for (int i = 0;i<array.size();i++){
                taskRuleIds.add(array.getString(i));
            }
            service.batchDelete(taskRuleIds);
            envelop.setObj(true);
            return envelop;
        }catch (Exception e){
            e.printStackTrace();
            tracer.getCurrentSpan().logEvent(e.getMessage());
            return Envelop.getError(e.getMessage());
        }
    }
}

+ 16 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/ActiveRecordDao.java

@ -0,0 +1,16 @@
package com.yihu.jw.dao;/**
 * Created by nature of king on 2018/5/10.
 */
import com.yihu.jw.entity.health.bank.ActiveRecordDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author wangzhinan
 * @create 2018-05-10 11:15
 * @desc health bank account dao
 **/
public interface ActiveRecordDao extends PagingAndSortingRepository<ActiveRecordDO,String>,JpaSpecificationExecutor<ActiveRecordDO> {
}

+ 0 - 11
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/ActivityRuleDao.java

@ -1,11 +0,0 @@
package com.yihu.jw.dao;
import com.yihu.jw.entity.health.bank.ActivityRuleDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wang zhinan on 2018/4/27.
 */
public interface ActivityRuleDao extends PagingAndSortingRepository<ActivityRuleDO,String>,JpaSpecificationExecutor<ActivityRuleDO>{
}

+ 8 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskDao.java

@ -4,12 +4,20 @@ package com.yihu.jw.dao;/**
import com.yihu.jw.entity.health.bank.TaskDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author wangzhinan
 * @create 2018-05-10 11:17
 * @desc health bank task dao
 **/
public interface TaskDao extends PagingAndSortingRepository<TaskDO,String>,JpaSpecificationExecutor<TaskDO> {
    @Query("select t from TaskDO t where t.transactionId = ?1 and t.type='ACTIVITY_TASK'")
    List<TaskDO> selectByActivityId(String transactionId);
    @Query("select t from TaskDO t where t.transactionId = ?1 and t.type='RULE_TASK'")
    TaskDO selectByTaskRuleId(String transactionId);
}

+ 0 - 11
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskDetailDao.java

@ -1,11 +0,0 @@
package com.yihu.jw.dao;
import com.yihu.jw.entity.health.bank.TaskDetailDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by wang zhinan on 2018/4/27.
 */
public interface TaskDetailDao extends PagingAndSortingRepository<TaskDetailDO,String>,JpaSpecificationExecutor<TaskDetailDO> {
}

+ 15 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskDictDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.dao;/**
 * Created by nature of king on 2018/6/8.
 */
import com.yihu.jw.entity.health.bank.TaskDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author wangzhinan
 * @create 2018-06-08 15:20
 * @desc 字典DAO
 **/
public interface TaskDictDao extends PagingAndSortingRepository<TaskDictDO,String>,JpaSpecificationExecutor<TaskDictDO> {
}

+ 15 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskGoodsDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.dao;/**
 * Created by nature of king on 2018/6/8.
 */
import com.yihu.jw.entity.health.bank.TaskGoodsDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author wangzhinan
 * @create 2018-06-08 15:28
 * @desc 商品 dao
 **/
public interface TaskGoodsDao extends PagingAndSortingRepository<TaskGoodsDO,String>,JpaSpecificationExecutor<TaskGoodsDO> {
}

+ 19 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskPatientDetailDao.java

@ -0,0 +1,19 @@
package com.yihu.jw.dao;
import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
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 wang zhinan on 2018/4/27.
 */
public interface TaskPatientDetailDao extends PagingAndSortingRepository<TaskPatientDetailDO,String>,JpaSpecificationExecutor<TaskPatientDetailDO> {
    @Query("select t from TaskPatientDetailDO t where t.activityId = ?1")
    List<TaskPatientDetailDO> selectByActivityId(String activityId);
    @Query("select t from TaskPatientDetailDO t where taskId = ?1")
    List<TaskPatientDetailDO> selectByTaskId(String taskId);
}

+ 15 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/dao/TaskRangDao.java

@ -0,0 +1,15 @@
package com.yihu.jw.dao;/**
 * Created by nature of king on 2018/6/8.
 */
import com.yihu.jw.entity.health.bank.TaskRangDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author wangzhinan
 * @create 2018-06-08 15:29
 * @desc 任务范围
 **/
public interface TaskRangDao extends PagingAndSortingRepository<TaskRangDO,String>,JpaSpecificationExecutor<TaskRangDO> {
}

+ 331 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/AccountService.java

@ -2,12 +2,19 @@ package com.yihu.jw.service;/**
 * Created by nature of king on 2018/5/10.
 */
import com.alibaba.fastjson.JSONArray;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.dao.AccountDao;
import com.yihu.jw.dao.TaskRuleDao;
import com.yihu.jw.entity.health.bank.AccountDO;
import com.yihu.jw.entity.health.bank.TaskDO;
import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
import com.yihu.jw.entity.health.bank.TaskRuleDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.util.DateUtils;
import com.yihu.jw.util.ISqlUtils;
import com.yihu.jw.util.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -15,6 +22,9 @@ import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -31,6 +41,8 @@ public class AccountService extends BaseJpaService<AccountDO,AccountDao> {
    private AccountDao accountDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private TaskRuleDao taskRuleDao;
    /**
     * 添加银行账户信息
@ -58,7 +70,167 @@ public class AccountService extends BaseJpaService<AccountDO,AccountDao> {
    public Envelop<AccountDO> findByCondition(AccountDO accountDO, Integer page, Integer size) throws ParseException {
        String sql = new ISqlUtils().getSql(accountDO,page,size,"*");
        List<AccountDO> accountDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
        for (AccountDO accountDO1:accountDOS){
            String sql1 = "select COALESCE(sum(bcd.integrate),0) as total from wlyy_health_bank_credits_detail bcd where bcd.trade_direction = 1" +
                    " AND bcd.create_time > '"+ DateUtils.getDayBegin()+"' AND bcd.create_time < '"+DateUtils.getDayEnd()+"' AND bcd.patient_id = '" + accountDO1.getPatientId() +"'"
                    +"AND transaction_id = '"+accountDO.getTaskId()+"'";
            List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sql1);
            Long count = 0L;
            if(rstotal!=null&&rstotal.size()>0){
                Object object = rstotal.get(0).get("total");
                if (object != null){
                    count = Long.parseLong(object.toString());
                }
            }
            accountDO1.setNowTotal(count);
            String activitySql1 =" SELECT " +
                    " SUM(ptpd.total) AS total FROM wlyy_health_bank_task_patient_detail ptpd " +
                    " WHERE " +" task_id = '" + accountDO.getTaskId() + "' " +
                    "and patient_id = '"+accountDO1.getPatientId()+"'";
            List<Map<String,Object>> rstotal6 = jdbcTemplate.queryForList(activitySql1);
            Long activityIntegrate = 0L;
            if(rstotal6!=null&&rstotal6.size()>0){
                Object object = rstotal6.get(0).get("total");
                if (object!=null){
                    activityIntegrate = Long.parseLong(object.toString());
                }
            }
            accountDO1.setActivityIntegrate(activityIntegrate);
            String activitySql = "SELECT  COUNT(*) AS total FROM ( SELECT * FROM " +
                    "wlyy_health_bank_task_patient_detail " +
                    " WHERE patient_id = '" + accountDO1.getPatientId()+
                    "'AND activity_id != '' GROUP BY activity_id ) btpd1";
            List<Map<String,Object>> rstotal1 = jdbcTemplate.queryForList(activitySql);
            Long activityCount = 0L;
            if(rstotal1!=null&&rstotal1.size()>0){
                Object object = rstotal1.get(0).get("total");
                if (object != null){
                    activityCount = Long.parseLong(object.toString());
                }
            }
            accountDO1.setActivityTotal(activityCount);
            String taskSql = "SELECT  COUNT(*) AS total FROM ( SELECT * FROM " +
                    "wlyy_health_bank_task_patient_detail " +
                    " WHERE patient_id = '" + accountDO1.getPatientId()+
                    "' GROUP BY task_id ) btpd1";
            List<Map<String,Object>> rstotal2 = jdbcTemplate.queryForList(taskSql);
            Long taskCount = 0L;
            if(rstotal2!=null&&rstotal2.size()>0){
                Object object = rstotal2.get(0).get("total");
                if (object != null ){
                    taskCount = Long.parseLong(object.toString());
                }
            }
            accountDO1.setTaskTotal(taskCount);
            if (accountDO.getPatientIds() != null && accountDO.getPatientIds().size() != 0){
                StringBuffer buffer = new StringBuffer();
                buffer.append(" (");
                for (int i=0;i<accountDO.getPatientIds().size();i++){
                    buffer.append("'"+accountDO.getPatientIds().get(i)+"'").append(",");
                }
                buffer.deleteCharAt(buffer.length()-1);
                buffer.append(") ");
                String accountSql = "select * from wlyy_health_bank_account where patient_id in "+buffer;
                List<AccountDO> accountDOSList = jdbcTemplate.query(accountSql,new BeanPropertyRowMapper<>(AccountDO.class));
                if (accountDOSList != null && accountDOSList.size() !=0){
                    String sql2 = " SELECT " +
                            " ba.total + COALESCE (bacd1.sum, 0) AS total " +
                            " FROM " +
                            " wlyy_health_bank_account ba " +
                            " LEFT JOIN ( " +
                            " SELECT " +
                            " COALESCE (SUM(bacd.integrate), 0) AS sum, " +
                            " bacd.account_id " +
                            "  FROM " +
                            " wlyy_health_bank_credits_detail bacd " +
                            " WHERE " +
                            " bacd.trade_direction = - 1 " +
                            " GROUP BY " +
                            " bacd.account_id ) bacd1 ON ba.id = bacd1.account_id " +
                            " WHERE " +
                            " ba.id = '"+accountDO1.getId()+"'";
                    List<Map<String,Object>> rstotal3 = jdbcTemplate.queryForList(sql2);
                    Long Count = 0L;
                    if(rstotal3!=null&&rstotal3.size()>0){
                        Object object = rstotal3.get(0).get("total");
                        if (object!=null){
                            Count = Long.parseLong(object.toString());
                        }
                    }
                    accountDO1.setSum(Count);
                    StringBuffer buffer1 = new StringBuffer();
                    buffer1.append(" (");
                    for (int i=0;i<accountDOSList.size();i++){
                        buffer1.append("'"+accountDOSList.get(i).getId()+"'").append(",");
                    }
                    buffer1.deleteCharAt(buffer1.length()-1);
                    buffer1.append(") ");
                    String sql3 = "SELECT " +
                            " COUNT(1) + 1 AS total " +
                            "FROM " +
                            " ( " +
                            " SELECT " +
                            " ba.id AS id, " +
                            " ba.total /*+ COALESCE (bacd1.sum, 0)*/ AS sum " +
                            " FROM " +
                            " wlyy_health_bank_account ba " +
                            /*" LEFT JOIN ( " +
                            " SELECT " +
                            " COALESCE (SUM(bacd.integrate), 0) AS sum, " +
                            " bacd.account_id " +
                            "  FROM " +
                            " wlyy_health_bank_credits_detail bacd " +
                            " WHERE " +
                            " bacd.trade_direction = - 1 " +
                            " GROUP BY " +
                            " bacd.account_id ) bacd1 ON ba.id = bacd1.account_id "+*/
                            " WHERE " +
                            " ba.id IN " +buffer1+
                            " )ba1 WHERE ba1.sum > "+accountDO1.getSum();
                    List<Map<String,Object>> rstotal4 = jdbcTemplate.queryForList(sql3);
                    Integer Count1 = 0;
                    if(rstotal4!=null&&rstotal4.size()>0){
                        Object object = rstotal4.get(0).get("total");
                        if (object != null){
                            Count1 = Integer.parseInt(object.toString());
                        }
                    }
                    accountDO1.setTeamRanking(Count1);
                    String sql4 = "SELECT " +
                            " COUNT(1) + 1 AS total " +
                            "FROM " +
                            " ( " +
                            " SELECT " +
                            " ba.id AS id, " +
                            " ba.total /*+ COALESCE (bacd1.sum, 0)*/ AS sum " +
                            " FROM " +
                            " wlyy_health_bank_account ba " +
                            /*" LEFT JOIN ( " +
                            " SELECT " +
                            " COALESCE (SUM(bacd.integrate), 0) AS sum, " +
                            " bacd.account_id " +
                            "  FROM " +
                            " wlyy_health_bank_credits_detail bacd " +
                            " WHERE " +
                            " bacd.trade_direction = - 1 " +
                            " GROUP BY " +
                            " bacd.account_id ) bacd1 ON ba.id = bacd1.account_id " +*/
                            " )ba1 WHERE ba1.sum > "+accountDO1.getSum();
                    List<Map<String,Object>> rstotal5 = jdbcTemplate.queryForList(sql4);
                    Integer Count2 = 0;
                    if(rstotal5!=null&&rstotal5.size()>0){
                        Object object = rstotal5.get(0).get("total");
                        if (object != null){
                            Count2 = Integer.parseInt(object.toString());
                        }
                    }
                    accountDO1.setCityRanking(Count2);
                }
            }
        }
        String sqlcount = new ISqlUtils().getSql(accountDO,0,0,"count");
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
        Long count = 0L;
@ -67,4 +239,163 @@ public class AccountService extends BaseJpaService<AccountDO,AccountDao> {
        }
        return Envelop.getSuccessListWithPage(HealthBankMapping.api_success,accountDOS,page,size,count);
    }
    /**
     * 根据条件活动用户信息
     *
     * @param page 页码
     *
     * @param size 分页大小
     * @return
     */
    public Envelop<AccountDO> findByCondition1(JSONArray patients, String ruleId, Integer page, Integer size){
        for (int i=0;i<patients.size();i++){
            String patientId = patients.getJSONObject(i).getString("code");
            String sql = "select * from wlyy_health_bank_account where patient_id = '"+patientId+"'";
            List<AccountDO> accountDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
            if (accountDOS == null || accountDOS.size() == 0) {
                AccountDO accountDO1 = new AccountDO();
                accountDO1.setPatientId(patientId);
                accountDO1.setTotal(0);
                accountDO1.setAccountName(patients.getJSONObject(i).getString("name"));
                accountDO1.setCardNumber(patients.getJSONObject(i).getString("idcard"));
                accountDO1.setHospital("350205");
                accountDO1.setPassword("321321312321");
                accountDO1.setHospitalName("海沧区");
                accountDO1.setCreateTime(new Date());
                accountDO1.setUpdateTime(new Date());
                accountDao.save(accountDO1);
            }
        }
        TaskRuleDO taskRuleDO = taskRuleDao.findOne(ruleId);
        String taskSql = "select * from wlyy_health_bank_task where transaction_id = '"+taskRuleDO.getId()+"'";
        List<TaskDO> taskDOList = jdbcTemplate.query(taskSql,new BeanPropertyRowMapper(TaskDO.class));
        List<String> ids = new ArrayList<>();
        if(taskDOList != null && taskDOList.size() != 0){
            if (taskRuleDO.getPeriod() == 1){
                for (int i = 0;i<patients.size();i++){
                    String patientId = patients.getJSONObject(i).getString("code");
                    String sql = "select * from wlyy_health_bank_task_patient_detail where patient_id = '"+patientId+"' AND task_id = '"+taskDOList.get(0).getId()+"'";
                    List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
                    if (taskPatientDetailDOS ==null || taskPatientDetailDOS.size() == 0){
                        ids.add(patientId);
                    }
                }
            }else if (taskRuleDO.getPeriod() == 0){
                for (int i = 0;i<patients.size();i++){
                    String patientId = patients.getJSONObject(i).getString("code");
                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
                    Date date = new Date();
                    String date1 = dateFormat.format(date);
                    String begin = DateUtils.getMinMonthDate(date1);
                    String end = DateUtils.getMaxMonthDate(date1);
                    String sql = "select * from wlyy_health_bank_task_patient_detail where patient_id = '"+patientId+"' AND task_id = '"+taskDOList.get(0).getId()+"' AND create_time > '"+begin+"' AND create_time < '"+end+"'";
                    List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
                    if (taskPatientDetailDOS ==null || taskPatientDetailDOS.size() == 0){
                        ids.add(patientId);
                    }
                }
            }
        }else {
            for (int i = 0;i<patients.size();i++){
                String patientId = patients.getJSONObject(i).getString("code");
                ids.add(patientId);
            }
        }
        StringBuffer buffer = new StringBuffer();
        buffer.append("(");
        if (ids == null || ids.size() == 0){
            buffer.append("''");
        }else {
            for (int i=0;i<ids.size();i++){
                buffer.append("'"+ids.get(i)+"'").append(",");
            }
            buffer.deleteCharAt(buffer.length()-1);
        }
        buffer.append(") ");
       /* StringBuffer buffer1 = new StringBuffer();//设备类型
        buffer1.append("(");
        if (deviceTypes == null || deviceTypes.size() == 0){
            buffer1.append("''");
        }else {
            for (int i=0;i<deviceTypes.size();i++){
                buffer1.append("'"+deviceTypes.get(i)+"'").append(",");
            }
            buffer1.deleteCharAt(buffer1.length()-1);
        }
        buffer1.append(")");
        String sql1 = null ;
        if (bindStatus == -1){
            sql1 = "( SELECT btpd.patient_id AS patient_id FROM " +
                    "  wlyy_health_bank_task_patient_detail btpd " +
                    " LEFT JOIN wlyy_health_bank_task bt ON bt.id = btpd.task_id WHERE " +
                    " bt.task_code NOT IN "+buffer1+" and "+buffer+")";
        }else if (bindStatus == 1){
            sql1 = "( SELECT btpd.patient_id AS patient_id FROM " +
                    "  wlyy_health_bank_task_patient_detail btpd " +
                    " LEFT JOIN wlyy_health_bank_task bt ON bt.id = btpd.task_id WHERE " +
                    " bt.task_code IN "+buffer1 +" and "+buffer+")";
        }*/
        String sql =
                "SELECT ba1.patient_id AS patient_id," +
                        "ba1.account_name AS account_name," +
                        "ba1.hospital AS hospital," +
                        "ba1.total AS total," +
                        "ba1.create_time AS create_time," +
                        "ba1.sum AS sum" +
                        " FROM" +
                        "( SELECT " +
                        "ba.patient_id AS patient_id," +
                        "ba.account_name AS account_name," +
                        "ba.hospital AS hospital," +
                        "ba.total AS total," +
                        "ba.create_time AS create_time," +
                        "(ba.total +COALESCE((cd1.total),0)) AS sum" +
                        " FROM" +
                        " wlyy_health_bank_account ba" +
                        " LEFT JOIN ( " +
                        "SELECT" +
                        " SUM(cd.integrate) AS total," +
                        " cd.patient_id AS patient_id" +
                        " FROM" +
                        " wlyy_health_bank_credits_detail cd" +
                        " WHERE " +
                        "cd.trade_direction = - 1" +
                        " GROUP BY " +
                        " cd.patient_id ) cd1 ON cd1.patient_id = ba.patient_id " +
                        " WHERE ba.patient_id IN " + buffer +
                        " ORDER BY" +
                        " ba.create_time DESC " +
                        "LIMIT "+(page-1)*size+","+size +")ba1" +
                        " ORDER BY " +
                        " ba1.sum DESC";
        List<AccountDO> accountDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
        String sqlCount = "SELECT count(1) AS total"+
                " FROM " +
                " wlyy_health_bank_account ba LEFT JOIN " +
                " ( " +
                " SELECT " +
                " SUM(cd.integrate) AS total, " +
                " cd.patient_id AS patient_id " +
                " FROM " +
                " wlyy_health_bank_credits_detail cd " +
                " WHERE " +
                " cd.trade_direction = - 1 " +
                " GROUP BY " +
                " cd.patient_id " +
                " ) cd1 ON cd1.patient_id = ba.patient_id " +
                "WHERE ba.patient_id IN " + buffer +
                " ORDER BY " +
                " ba.create_time, " +
                " (ba.total + COALESCE(cd1.total,0)) DESC ";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return Envelop.getSuccessListWithPage(HealthBankMapping.api_success, accountDOS,page,size,count);
    }
}

+ 88 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActiveRecordService.java

@ -0,0 +1,88 @@
package com.yihu.jw.service;/**
 * Created by nature of king on 2018/5/10.
 */
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.dao.AccountDao;
import com.yihu.jw.dao.ActiveRecordDao;
import com.yihu.jw.dao.ActivityDao;
import com.yihu.jw.dao.TaskDao;
import com.yihu.jw.entity.health.bank.AccountDO;
import com.yihu.jw.entity.health.bank.ActiveRecordDO;
import com.yihu.jw.entity.health.bank.ActivityDO;
import com.yihu.jw.entity.health.bank.TaskDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.util.ISqlUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.transaction.Transactional;
import java.text.ParseException;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author wangzhinan
 * @create 2018-05-10 11:26
 * @desc account service
 **/
@Service
@Transactional
public class ActiveRecordService extends BaseJpaService<ActiveRecordDO,ActiveRecordDO> {
    @Autowired
    private TaskDao taskDao;
    @Autowired
    private ActivityDao activityDao;
    @Autowired
    private ActiveRecordDao activeRecordDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 添加健康银行活动活跃记录
     *
     * @return
     */
    public ActiveRecordDO insert(String saasId,String taskId,String activityId,Integer originalStatus,Integer currentStatus,
    String patientId) throws Exception{
        ActiveRecordDO activeRecordDO = new ActiveRecordDO();
        activeRecordDO.setSaasId(saasId);
        if(!StringUtils.isEmpty(taskId)){
            activeRecordDO.setTaskId(taskId);
            TaskDO taskDO = taskDao.findOne(taskId);
            activeRecordDO.setTaskTitle(taskDO!=null?taskDO.getTitle():null);
            if(StringUtils.isEmpty(activityId)&&"ACTIVITY_TASK".equals(taskDO.getType())){
                activityId = taskDO.getTransactionId();
            }
        }
        if(!StringUtils.isEmpty(activityId)){
            activeRecordDO.setActivityId(activityId);
            ActivityDO activityDO = activityDao.findOne(activityId);
            activeRecordDO.setActivityTitle(activityDO!=null?activityDO.getTitle():null);
        }
        activeRecordDO.setOriginalStatus(originalStatus);
        activeRecordDO.setCurrentStatus(currentStatus);
        String sql = " select * from wlyy.wlyy_patient where code='"+patientId+"' and status=1 ";
        Map<String,Object> result = jdbcTemplate.queryForMap(sql);
        activeRecordDO.setPatientId(patientId);
        if(result!=null){
            activeRecordDO.setPatientName(result.get("name")+"");
        }
        String sql2 = "select f.* from wlyy.wlyy_sign_family f where f.patient='"+patientId+"' and f.status=1 and f.expenses_status=1";
//        Map<String,Object> result2 = jdbcTemplate.queryForMap(sql2);
        List<Map<String, Object>> result2 = jdbcTemplate.queryForList(sql2);
        if(result2!=null&&result2.size()>0){
            activeRecordDO.setTeamId(result2.get(0).get("admin_team_code")!=null?(Integer)result2.get(0).get("admin_team_code"):null);;
        }
        activeRecordDO.setCreateTime(new Date());
        return activeRecordDao.save(activeRecordDO);
    }
}

+ 0 - 109
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityRuleService.java

@ -1,109 +0,0 @@
package com.yihu.jw.service;/**
 * Created by nature of king on 2018/4/27.
 */
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.dao.ActivityDao;
import com.yihu.jw.dao.ActivityRuleDao;
import com.yihu.jw.dao.CredittsLogDetailDao;
import com.yihu.jw.entity.health.bank.ActivityRuleDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.text.ParseException;
/**
 * @author wangzhinan
 * @create 2018-04-27 14:40
 * @desc health activity info Service
 **/
@Service
@Transactional
public class ActivityRuleService extends BaseJpaService<ActivityRuleDO,ActivityRuleDao> {
    @Autowired
    private ActivityRuleDao activityRuleDao;
    @Autowired
    private ActivityDao activityDao;
    @Autowired
    private CredittsLogDetailDao credittsLogDetailDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * insert activityRuleDO
     *
     * @param activityRuleDO
     * @return
    public Envelop<Boolean> insert(ActivityRuleDO activityRuleDO){
        activityRuleDao.save(activityRuleDO);
        Envelop<Boolean> envelop = new Envelop<>();
        envelop.setObj(true);
        return envelop;
    }
    *//**
     *  find by condition
     *
     * @param activityRuleDO
     * @param page
     * @param size
     * @return
     * @throws ParseException
     *//*
    public Envelop<ActivityRuleDO> findByCondition(ActivityRuleDO activityRuleDO, Integer page, Integer size) throws ParseException {
        String sql = new ISqlUtils().getSql(activityRuleDO,page,size,"*");
        List<ActivityRuleDO> activityRuleDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityRuleDO.class));
        List<ActivityRuleDO> activityRuleDOList = new ArrayList<>();
        for (ActivityRuleDO activityRuleDO1 : activityRuleDOS){
            ActivityDO activityDO = activityDao.findOne(activityRuleDO1.getActivityId());
            activityRuleDO1.setActivityDO(activityDO);
            activityRuleDOList.add(activityRuleDO1);
        }
        String sqlcount = new ISqlUtils().getSql(activityRuleDO,0,0,"count");
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return Envelop.getSuccessListWithPage(HealthBankMapping.api_success, activityRuleDOList,page,size,count);
    }
    *//**
     * update activityRuleDO
     *
     * @param activityRuleDO
     * @return
     *//*
    public Envelop<Boolean> update(ActivityRuleDO activityRuleDO){
        ActivityDO activityDO = activityDao.findOne(activityRuleDO.getActivityId());
        ActivityRuleDO activityRuleDO1 = new ActivityRuleDO();
        activityRuleDO1 = activityRuleDao.findOne(activityRuleDO.getId());
        if (activityRuleDO.getStatus().equalsIgnoreCase("finished")){
            activityRuleDO.setIntegrate(activityDO.getIntegrate());
        }
        String sql = "select cl.status as status,cl.total as total from health_bank_credits_log cl order by cl.update_time desc";
        List<CreditsDetailDO> creditsLogDetailDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(CreditsDetailDO.class));
        activityRuleDao.save(activityRuleDO);
        if (activityRuleDO.getStatus().equalsIgnoreCase("finished")&&!activityRuleDO1.getStatus().equalsIgnoreCase("unfinished")){
            CreditsDetailDO creditsLogDetailDO = new CreditsDetailDO();
            if (creditsLogDetailDOList == null || creditsLogDetailDOList.size() ==0){
                creditsLogDetailDO.setTotal(Long.parseLong(activityDO.getIntegrate()));
            }else {
                creditsLogDetailDO.setTotal(Long.parseLong(activityDO.getIntegrate().replace("+",""))+ creditsLogDetailDOList.get(0).getTotal());
            }
            creditsLogDetailDO.setPatientId(activityRuleDO.getPatientId());
            creditsLogDetailDO.setIntegrate("+"+ activityRuleDO.getIntegrate());
            creditsLogDetailDO.setIntegrateType("HEALTH_ACTIVITY");
            creditsLogDetailDO.setIntegrateId(activityRuleDO.getActivityId());
            creditsLogDetailDO.setStatus("unused");
            creditsLogDetailDO.setCommunity(activityDO.getCommunity());
            credittsLogDetailDao.save(creditsLogDetailDO);
        }
        Envelop<Boolean> envelop = new Envelop<>();
        envelop.setObj(true);
        return envelop;
    }*/
}

+ 171 - 2
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/ActivityService.java

@ -4,17 +4,24 @@ package com.yihu.jw.service;/**
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.dao.ActivityDao;
import com.yihu.jw.dao.TaskDao;
import com.yihu.jw.dao.TaskPatientDetailDao;
import com.yihu.jw.entity.health.bank.ActivityDO;
import com.yihu.jw.entity.health.bank.TaskDO;
import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.util.ISqlUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.couchbase.CouchbaseProperties;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -30,8 +37,13 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
    @Autowired
    private ActivityDao activityDao;
    @Autowired
    private TaskPatientDetailDao taskPatientDetailDao;
    @Autowired
    private TaskDao taskDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * insert activityDO
     *
@ -39,6 +51,8 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
     * @return
     */
    public Envelop<Boolean> insert(ActivityDO activityDO){
        activityDO.setCreateTime(new Date());
        activityDO.setUpdateTime(new Date());
        activityDao.save(activityDO);
        Envelop<Boolean> envelop = new Envelop<>();
        envelop.setObj(true);
@ -58,7 +72,32 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
    public Envelop<ActivityDO> findByCondition(ActivityDO activityDO,Integer page, Integer size) throws ParseException {
        String sql = new ISqlUtils().getSql(activityDO,page,size,"*");
        List<ActivityDO> activityDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class));
        for (ActivityDO activityDO1:activityDOS){
            String taskSql = "SELECT" +
                    " COUNT(1) AS total1 " +
                    "FROM " +
                    " ( " +
                    " SELECT DISTINCT " +
                    "  (btpd.patient_openid) " +
                    "  FROM " +
                    "  wlyy_health_bank_task_patient_detail btpd " +
                    "  WHERE " +
                    "  activity_id = '" +activityDO1.getId()+
                    "' ) btpd1";
            List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(taskSql);
            Long count = 0L;
            if(rstotal!=null&&rstotal.size()>0){
                count = (Long) rstotal.get(0).get("total1");
            }
            activityDO1.setTotal(count);
            String taskSql1 = "select * from wlyy_health_bank_task_patient_detail btpd where activity_id = '"+activityDO1.getId()
                    +"' and (patient_idcard = '"+activityDO.getPatientIdcard()+"' OR union_id = '"+activityDO.getUnionId()+"')";
            List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(taskSql1,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
            activityDO1.setTaskPatientDetailDOS(taskPatientDetailDOS);
            String tasksql = "select * from wlyy_health_bank_task where transaction_id = '"+activityDO1.getId()+"'";
            List<TaskDO> taskDOList = jdbcTemplate.query(tasksql,new BeanPropertyRowMapper(TaskDO.class));
            activityDO1.setTaskDOS(taskDOList);
        }
        String sqlcount = new ISqlUtils().getSql(activityDO,0,0,"count");
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
        Long count = 0L;
@ -71,7 +110,7 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
    /**
     * update activityDO
     *
     * @param activityDO 活动采参数对象
     * @param activityDO 活动参数对象
     * @return
     */
    public Envelop<Boolean> update(ActivityDO activityDO){
@ -80,4 +119,134 @@ public class ActivityService extends BaseJpaService<ActivityDO,ActivityDao> {
        envelop.setObj(true);
        return envelop;
    }
    /**
     * 获取参与的活动
     *
     * @param activityDO 活动对象
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    public Envelop<ActivityDO> selectByPatient(ActivityDO activityDO,Integer page,Integer size){
        String sql ="SELECT * " +
                " FROM wlyy_health_bank_activity " +
                "WHERE " +
                "id IN ( " +
                "SELECT bt.transaction_id " +
                "FROM wlyy_health_bank_task bt " +
                "WHERE id IN (" +
                " SELECT task_id FROM " +
                "wlyy_health_bank_task_patient_detail" +
                " WHERE " +
                " patient_openid = '"+activityDO.getOpenId()+ "' AND patient_idcard = '"+activityDO.getPatientIdcard()+"' AND union_id = '"+ activityDO.getUnionId()+"')" +
                " )" +
                " LIMIT "+(page-1)*size +","+size;
        List<ActivityDO> activityDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(ActivityDO.class));
        for (ActivityDO activityDO1:activityDOS){
            String activitySql ="SELECT btpd1.sum AS total FROM (SELECT " +
                    " SUM(total) AS sum , " +
                    " patient_id, " +
                    " patient_openid, " +
                    " patient_idcard, " +
                    " activity_id," +
                    " union_id " +
                    " FROM " +
                    " wlyy_health_bank_task_patient_detail " +
                    "GROUP BY patient_openid,patient_idcard,union_id)btpd1 " +
                    "WHERE " +
                    " btpd1.activity_id = '"+activityDO1.getId() +"' AND patient_openid = '"+activityDO.getOpenId()+ "' AND patient_idcard = '"+activityDO.getPatientIdcard()+"' AND union_id = '"+ activityDO.getUnionId()+"'";
            List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(activitySql);
            Long count = 0L;
            if(rstotal!=null&&rstotal.size()>0){
                Object object =  rstotal.get(0).get("total");
                count = Long.parseLong(object.toString());
            }
            activityDO1.setSum(count);
            String rankingSql = "SELECT count(1)+1 AS total FROM (SELECT " +
                    " SUM(total) AS sum , " +
                    " patient_id, " +
                    " patient_openid, " +
                    " patient_idcard, " +
                    " activity_id " +
                    "FROM " +
                    " wlyy_health_bank_task_patient_detail " +
                    "GROUP BY patient_openid,patient_idcard,union_id)btpd1 " +
                    "WHERE " +
                    " btpd1.activity_id = '"+activityDO1.getId()+"' AND btpd1.sum >" +activityDO1.getSum() ;
            List<Map<String,Object>> rstotal1 = jdbcTemplate.queryForList(rankingSql);
            Integer count1 = 0;
            if(rstotal1!=null&&rstotal1.size()>0){
                Object object =  rstotal1.get(0).get("total");
                count1 = Integer.parseInt(object.toString());
            }
            activityDO1.setActivityRanking(count1);
            String taskSql = "SELECT" +
                    " COUNT(1) AS total1 " +
                    "FROM " +
                    " ( " +
                    " SELECT * " +
                    "  FROM " +
                    "  wlyy_health_bank_task_patient_detail btpd " +
                    "  WHERE " +
                    "  activity_id = '" +activityDO1.getId()+
                    "' GROUP BY patient_openid,patient_idcard,union_id) btpd1";
            List<Map<String,Object>> rstotal2 = jdbcTemplate.queryForList(taskSql);
            Long count2 = 0L;
            if(rstotal2!=null&&rstotal2.size()>0){
                count2 = (Long) rstotal2.get(0).get("total1");
            }
            activityDO1.setTotal(count2);
        }
        String sqlcount = "SELECT count(1) AS total" +
                " FROM wlyy_health_bank_activity " +
                "WHERE " +
                "id IN ( " +
                "SELECT bt.transaction_id " +
                "FROM wlyy_health_bank_task bt " +
                "WHERE id IN (" +
                " SELECT task_id FROM " +
                "wlyy_health_bank_task_patient_detail" +
                " WHERE " +
                " patient_openid = '"+activityDO.getOpenId()+ "' AND patient_idcard = '"+activityDO.getPatientIdcard()+"' AND union_id = '"+ activityDO.getUnionId()+"' )" +
                " )";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return Envelop.getSuccessListWithPage(HealthBankMapping.api_success,activityDOS,page,size,count);
    }
    /**
     * 批量删除活动
     *
     * @param ids 活动id集合
     * @return
     */
    public Envelop<Boolean> batchDelete(List<String> ids){
        Envelop<Boolean> envelop = new Envelop<>();
        for (int i =0;i<ids.size();i++){
            List<TaskDO> taskDOList = taskDao.selectByActivityId(ids.get(i));
            for (TaskDO taskDO:taskDOList){
                taskDO.setStatus(0);
                taskDO.setCreateTime(new Date());
                taskDO.setUpdateTime(new Date());
                taskDao.save(taskDO);
            }
            List<TaskPatientDetailDO> taskPatientDetailDOS = taskPatientDetailDao.selectByActivityId(ids.get(i));
            for(TaskPatientDetailDO taskPatientDetailDO:taskPatientDetailDOS){
                taskPatientDetailDO.setStatus(-1);
                taskPatientDetailDO.setCreateTime(new Date());
                taskPatientDetailDO.setUpdateTime(new Date());
                taskPatientDetailDao.save(taskPatientDetailDO);
            }
            ActivityDO activityDO = activityDao.findOne(ids.get(i));
            activityDO.setStatus(-1);
            activityDO.setCreateTime(new Date());
            activityDO.setUpdateTime(new Date());
            activityDao.save(activityDO);
        }
        return envelop;
    }
}

+ 642 - 46
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/CreditsDetailService.java

@ -2,19 +2,27 @@ package com.yihu.jw.service;/**
 * Created by nature of king on 2018/4/27.
 */
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.dao.*;
import com.yihu.jw.entity.health.bank.*;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.util.DateUtils;
import com.yihu.jw.util.ISqlUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -29,7 +37,9 @@ import java.util.Map;
@Transactional
public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,CredittsLogDetailDao> {
    private Logger logger = LoggerFactory.getLogger(CreditsDetailService.class);
    private static String STEP = "health:blank:step";
    @Autowired
    private CredittsLogDetailDao credittsLogDetailDao;
    @Autowired
@ -41,23 +51,27 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
    @Autowired
    private AccountDao accountDao;
    @Autowired
    private TaskDetailDao taskDetailDao;
    private TaskPatientDetailDao taskPatientDetailDao;
    @Autowired
    private TaskRuleDao taskRuleDao;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private ActiveRecordService activeRecordService;
   /**
     *  find creditsLogInfo
     *
     * @return
     * @throws ParseException
     */
    public Envelop<CreditsDetailDO> findByCondition(CreditsDetailDO creditsDetailDO, Integer page, Integer size) throws ParseException {
   public Envelop<CreditsDetailDO> findByCondition(CreditsDetailDO creditsDetailDO, Integer page, Integer size) throws ParseException {
        String sql = new ISqlUtils().getSql(creditsDetailDO,page,size,"*");
        List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(CreditsDetailDO.class));
        for (CreditsDetailDO creditsDetailDO1 : creditsDetailDOS){
            if (creditsDetailDO1.getTradeType().equalsIgnoreCase("HEALTH_TASK")){
            if (creditsDetailDO1.getTradeType() != null && creditsDetailDO1.getTradeType().equalsIgnoreCase("ACTIVITY_TASK")){
                TaskDO taskDO = taskDao.findOne(creditsDetailDO1.getTransactionId());
                creditsDetailDO1.setTaskDO(taskDO);
            }else if(creditsDetailDO1.getTradeType().equalsIgnoreCase("HEALTH_ACTIVITY")){
                ActivityDO activityDO = activityDao.findOne(creditsDetailDO1.getTransactionId());
                creditsDetailDO1.setActivityDO(activityDO);
            }
        }
        String sqlcount = new ISqlUtils().getSql(creditsDetailDO,0,0,"count");
@ -84,10 +98,16 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
        if (accountDOS == null || accountDOS.size() == 0){
            accountDO1.setTotal(0);
            accountDO1.setAccountName(creditsDetailDO.getName());
            accountDO1.setCardNumber("jw");
            accountDO1.setHospital("海沧区");
            accountDO1.setPassword("321321312321");
            accountDO1.setHospitalName("haichan");
            if(creditsDetailDO.getIdCard().length()>=4){// 判断是否长度大于等于4
                String cardNumber=creditsDetailDO.getIdCard().substring(creditsDetailDO.getIdCard().length()- 4,creditsDetailDO.getIdCard().length());//截取两个数字之间的部分
                int random = (int)((Math.random()*9+1)*100000);
                accountDO1.setCardNumber(cardNumber+Integer.toString(random));
            }
            accountDO1.setHospital(creditsDetailDO.getHospital());
            accountDO1.setPassword("123456");
            accountDO1.setHospitalName(creditsDetailDO.getHospitalName());
            accountDO1.setStatus(1);
            accountDO1.setSaasId("dev");
            accountDO1.setCreateTime(new Date());
            accountDO1.setUpdateTime(new Date());
            accountDao.save(accountDO1);
@ -109,7 +129,6 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
    /*
    public Envelop<Boolean> exchangeGoods(GoodsDO goodsDO){
        CreditsDetailDO creditsLogDetailDO = new CreditsDetailDO();
@ -147,7 +166,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                        "ba.hospital AS hospital," +
                        "ba.total AS total," +
                        "ba.create_time AS create_time," +
                        "(ba.total +(cd1.total)) AS sum" +
                        " if(ba.total=0,ba.total,(ba.total +COALESCE((cd1.total),0))) AS sum" +
                        " FROM" +
                        " wlyy_health_bank_account ba" +
                        " LEFT JOIN ( " +
@ -159,13 +178,13 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                        " WHERE " +
                        "cd.trade_direction = - 1" +
                        " GROUP BY " +
                        " cd.patient_id ) cd1 ON cd1.patient_id = ba.patient_id\n" +
                        " cd.patient_id ) cd1 ON cd1.patient_id = ba.patient_id " +
                        " WHERE " + buffer +
                        " ORDER BY" +
                        " ba.create_time DESC " +
                        "LIMIT "+(page-1)*size+","+size +")ba1" +
                        " ORDER BY " +
                        " ba1.sum DESC";
                        " ba1.total DESC";
        List<AccountDO> accountDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
        String sqlCount = "SELECT count(1) AS total"+
                " FROM " +
@ -184,7 +203,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                "WHERE " + buffer +
                " ORDER BY " +
                " ba.create_time, " +
                " (ba.total + cd1.total) DESC ";
                " (ba.total + COALESCE(cd1.total,0)) DESC ";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
@ -212,10 +231,15 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                    accountDO1.setPatientId(creditsDetailDO.getPatientId());
                    accountDO1.setTotal(0);
                    accountDO1.setAccountName(creditsDetailDO.getName());
                    accountDO1.setCardNumber("jw");
                    accountDO1.setHospital("海沧区");
                    accountDO1.setPassword("321321312321");
                    accountDO1.setHospitalName("haichan");
                    if(creditsDetailDO.getIdCard().length()>=4){// 判断是否长度大于等于4
                        String cardNumber=creditsDetailDO.getIdCard().substring(creditsDetailDO.getIdCard().length()- 4,creditsDetailDO.getIdCard().length());//截取两个数字之间的部分
                        int random = (int)((Math.random()*9+1)*100000);
                        accountDO1.setCardNumber(cardNumber+Integer.toString(random));
                    }
                    accountDO1.setHospital(creditsDetailDO.getHospital());
                    accountDO1.setPassword("123456");
                    accountDO1.setHospitalName(creditsDetailDO.getHospitalName());
                    accountDO1.setStatus(1);
                    accountDO1.setCreateTime(new Date());
                    accountDO1.setUpdateTime(new Date());
                    accountDao.save(accountDO1);
@ -224,31 +248,49 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                }
                TaskDO taskDO = new TaskDO();
                taskDO.setTaskCode(creditsDetailDO.getFlag());
                taskDO.setPatientId(creditsDetailDO.getPatientId());
                taskDO.setId(creditsDetailDO.getTransactionId());
                /*taskDO.setPatientId(creditsDetailDO.getPatientId());*/
                String sql = ISqlUtils.getSql(taskDO,1,1,"*");
                List<TaskDO> taskDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskDO.class));
                if (taskDOList != null && taskDOList.size() != 0){
                    creditsDetailDO.setTransactionId(taskDOList.get(0).getId());
                }else {
                    List<TaskDO> taskDOS = getTasks(taskDO.getPatientId());
                    for (TaskDO taskDO1:taskDOS){
                        taskDao.save(taskDO1);
                    }
                    List<TaskDO> taskDOList1 = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskDO.class));
                    creditsDetailDO.setTransactionId(taskDOList1.get(0).getId());
                }
                if (creditsDetailDO.getTradeDirection() == 1){
                    if (creditsDetailDO.getTradeType().equals("HEALTH_TASK")){
                        TaskDetailDO taskDetailDO = new TaskDetailDO();
                        taskDetailDO.setIntegrate(creditsDetailDO.getIntegrate());
                        taskDetailDO.setTaskId(creditsDetailDO.getTransactionId());
                        taskDetailDO.setSaasId(creditsDetailDO.getSaasId());
                        taskDetailDO.setPatientId(creditsDetailDO.getPatientId());
                        taskDetailDO.setTradeDirection(creditsDetailDO.getTradeDirection());
                        taskDetailDO.setStatus("1");
                        taskDetailDO.setCreateTime(new Date());
                        taskDetailDO.setUpdateTime(new Date());
                        taskDetailDao.save(taskDetailDO);
                creditsDetailDO.setTransactionId(taskDOList.get(0).getId());
                String ruleSql = "SELECT * FROM wlyy_health_bank_task_rule WHERE id= '"+taskDOList.get(0).getRuleCode()+"'";
                List<TaskRuleDO> taskRuleDOS = jdbcTemplate.query(ruleSql,new BeanPropertyRowMapper(TaskRuleDO.class));
                TaskRuleDO taskRuleDO = taskRuleDOS.get(0);
                creditsDetailDO.setIntegrate(taskRuleDO.getIntegrate());
                creditsDetailDO.setTradeDirection(taskRuleDO.getTradeDirection());
                String taskSql = "select * from wlyy_health_bank_task_patient_detail where task_id = '"+taskDOList.get(0).getId()+"' and patient_id = '" + creditsDetailDO.getPatientId() +"'";
                List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(taskSql,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
                if (taskPatientDetailDOS == null || taskPatientDetailDOS.size() ==0){
                    TaskPatientDetailDO taskPatientDetailDO = new TaskPatientDetailDO();
                    taskPatientDetailDO.setTaskId(creditsDetailDO.getTransactionId());
                    taskPatientDetailDO.setSaasId(creditsDetailDO.getSaasId());
                    taskPatientDetailDO.setPatientId(creditsDetailDO.getPatientId());
                    taskPatientDetailDO.setPatientIdcard(creditsDetailDO.getIdCard());
                    taskPatientDetailDO.setPatientOpenid(creditsDetailDO.getOpenId());
                    taskPatientDetailDO.setUnionId(creditsDetailDO.getUnionId());
                    taskPatientDetailDO.setStatus(Integer.parseInt("0"));
                    taskPatientDetailDO.setCreateTime(new Date());
                    taskPatientDetailDO.setUpdateTime(new Date());
                    taskPatientDetailDO.setActivityId(taskDOList.get(0).getTransactionId());
                    taskPatientDetailDO.setTotal(Long.parseLong("0"));
                    taskPatientDetailDao.save(taskPatientDetailDO);
                }else if (taskPatientDetailDOS != null && taskDOList.get(0).getPeriod() == 0){
                    String taskSql1 = "select * from wlyy_health_bank_task_patient_detail where task_id = '"+taskDOList.get(0).getId()+
                            "' and patient_id = '"+creditsDetailDO.getPatientId()+"' and create_time > '" + DateUtils.getDayBegin() +"' and create_time < '"+ DateUtils.getDayEnd() +"'";
                    List<TaskPatientDetailDO> taskPatientDetailDOS1 = jdbcTemplate.query(taskSql1,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
                    if (taskPatientDetailDOS1 == null || taskPatientDetailDOS1.size() == 0){
                        TaskPatientDetailDO taskPatientDetailDO = new TaskPatientDetailDO();
                        taskPatientDetailDO.setTaskId(creditsDetailDO.getTransactionId());
                        taskPatientDetailDO.setSaasId(creditsDetailDO.getSaasId());
                        taskPatientDetailDO.setPatientId(creditsDetailDO.getPatientId());
                        taskPatientDetailDO.setPatientIdcard(creditsDetailDO.getIdCard());
                        taskPatientDetailDO.setPatientOpenid(creditsDetailDO.getOpenId());
                        taskPatientDetailDO.setActivityId(taskDOList.get(0).getTransactionId());
                        taskPatientDetailDO.setStatus(Integer.parseInt("0"));
                        taskPatientDetailDO.setCreateTime(new Date());
                        taskPatientDetailDO.setUpdateTime(new Date());
                        taskPatientDetailDO.setTotal(Long.parseLong("0"));
                        taskPatientDetailDao.save(taskPatientDetailDO);
                    }
                }
                creditsDetailDO.setCreateTime(new Date());
@ -257,6 +299,18 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
                creditsDetailDO1.setFlag(creditsDetailDO.getFlag());
                List<CreditsDetailDO> creditsDetailDOList = new ArrayList<>();
                creditsDetailDOList.add(creditsDetailDO1);
                TaskPatientDetailDO taskPatientDetailDO = new TaskPatientDetailDO();
                taskPatientDetailDO.setPatientId(creditsDetailDO1.getPatientId());
                taskPatientDetailDO.setTaskId(creditsDetailDO1.getTransactionId());
                String taskSql1 = ISqlUtils.getAllSql(taskPatientDetailDO);
                List<TaskPatientDetailDO> taskPatientDetailDOS1 = jdbcTemplate.query(taskSql1,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
                TaskPatientDetailDO taskPatientDetailDO1 = taskPatientDetailDOS1.get(0);
                if (creditsDetailDO1.getTradeDirection() == 1){
                    taskPatientDetailDO1.setTotal(taskPatientDetailDO1.getTotal()+creditsDetailDO1.getIntegrate());
                }else if (creditsDetailDO.getTradeDirection() == -1){
                    taskPatientDetailDO1.setTotal(taskPatientDetailDO1.getTotal()-creditsDetailDO1.getIntegrate());
                }
                taskPatientDetailDao.save(taskPatientDetailDO1);
                AccountDO accountDO = accountDao.findOne(creditsDetailDO1.getAccountId());
                if (creditsDetailDO1.getTradeDirection() == 1){
                    accountDO.setTotal(accountDO.getTotal()+creditsDetailDO1.getIntegrate());
@ -280,17 +334,394 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
        }
    }
    /**
     * 活动排名
     *
     * @param activityId 活动id
     * @param ids 微信编码
     *
     * @param page 页码
     *
     * @param size 分页大小
     * @return
     */
    public Envelop<TaskPatientDetailDO> selectByActivityRanking(String activityId,List<String> ids,Integer page,Integer size){
        StringBuffer buffer = new StringBuffer();
        buffer.append("(");
        if (ids == null || ids.size() == 0){
            buffer.append("''");
        }else {
            for (int i=0;i<ids.size();i++){
                buffer.append("'"+ids.get(i)+"'").append(",");
            }
            buffer.deleteCharAt(buffer.length()-1);
        }
        buffer.append(") ");
        String sql = "SELECT " +
                " * " +
                "FROM " +
                " ( " +
                " SELECT " +
                " SUM(ptpd.total) AS total, " +
                " ptpd.patient_openid AS patient_openid, " +
                " ptpd.task_id AS task_id, " +
                " ptpd.activity_id AS activity_id, " +
                " ptpd.create_time as create_time, " +
                " ptpd.patient_id AS patient_id " +
                " FROM " +
                " wlyy_health_bank_task_patient_detail ptpd " +
                " WHERE " +
                " activity_id = '" + activityId +
                "' GROUP BY " +
                " patient_id " +
                " ORDER BY ptpd.create_time DESC " +
                " )btpd1 " +
                " WHERE  patient_id IN "+buffer+
                " ORDER BY btpd1.total DESC "+" LIMIT " + (page-1)*size+","+size;
        List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
        for (TaskPatientDetailDO taskPatientDetailDO : taskPatientDetailDOS){
            String accountSql = "select * from wlyy_health_bank_account where patient_id = '"+taskPatientDetailDO.getPatientId()+"'";
            List<AccountDO> accountDOS = jdbcTemplate.query(accountSql,new BeanPropertyRowMapper(AccountDO.class));
            taskPatientDetailDO.setAccountDO(accountDOS.get(0));
        }
        String sqlCount =  "SELECT " +
                " count(1) AS total " +
                "FROM " +
                " ( " +
                " SELECT " +
                " SUM(ptpd.total) AS total, " +
                " ptpd.patient_openid AS patient_openid, " +
                " ptpd.task_id AS task_id, " +
                " ptpd.activity_id AS activity_id, " +
                " ptpd.create_time as create_time, " +
                " ptpd.patient_id AS patient_id " +
                " FROM " +
                " wlyy_health_bank_task_patient_detail ptpd " +
                " WHERE " +
                " activity_id = '" + activityId+
                "' GROUP BY " +
                " patient_openid " +
                " ORDER BY ptpd.create_time DESC " +
                " )btpd1 " +
                "WHERE  patient_openid IN "+buffer+
                " ORDER BY btpd1.total DESC ";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return Envelop.getSuccessListWithPage(HealthBankMapping.api_success, taskPatientDetailDOS,page,size,count);
    }
    /**
     * 固定数据
     * 根据活动查询积分
     *
     * @param activityId 活动id
     *
     * @param patientId 居民id
     *
     * @param page 页码
     *
     * @param size 分页大小
     * @return
     */
    public Envelop<CreditsDetailDO> selectByActivity(String activityId,String patientId,Integer page,Integer size){
        String sql="SELECT * " +
                "FROM " +
                " wlyy_health_bank_credits_detail " +
                "WHERE" +
                " transaction_id IN ( " +
                " SELECT " +
                " bt.id " +
                " FROM " +
                " wlyy_health_bank_task bt " +
                " WHERE " +
                " transaction_id = '"+activityId +"' " +
                " ) " +
                " and patient_id = '" +patientId+
                "' LIMIT "+(page-1)*size +","+size;
        List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(CreditsDetailDO.class));
        for (CreditsDetailDO creditsDetailDO : creditsDetailDOS){
            TaskDO taskDO = taskDao.findOne(creditsDetailDO.getTransactionId());
            creditsDetailDO.setTaskDO(taskDO);
        }
        String sqlcount = "SELECT count(1) AS" +
                " total FROM " +
                " wlyy_health_bank_credits_detail " +
                "WHERE" +
                " transaction_id IN ( " +
                " SELECT " +
                " bt.id " +
                " FROM " +
                " wlyy_health_bank_task bt " +
                " WHERE " +
                " transaction_id = '"+activityId +"' " +
                " ) " +
                " and patient_id = '" +patientId+
                "'";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return Envelop.getSuccessListWithPage(HealthBankMapping.api_success,creditsDetailDOS,page,size,count);
    }
    /**
     * 根据活动查找全部排行
     *
     * @param patientId
     * @param activityId 活动id
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    public Envelop<TaskPatientDetailDO> selectByActivityRanking1(String activityId,String patientId,Integer page,Integer size){
        String sql = "SELECT " +
                " * " +
                "FROM " +
                " ( " +
                " SELECT " +
                " SUM(ptpd.total) AS total, " +
                " ptpd.patient_openid AS patient_openid, " +
                " ptpd.task_id AS task_id, " +
                " ptpd.activity_id AS activity_id, " +
                " ptpd.create_time as create_time, " +
                " ptpd.patient_id AS patient_id " +
                " FROM " +
                " wlyy_health_bank_task_patient_detail ptpd " +
                " WHERE " +
                " activity_id = '" + activityId +
                "' GROUP BY " +
                " patient_openid " +
                " ORDER BY ptpd.create_time DESC " +
                " )btpd1 " +
                " ORDER BY btpd1.total DESC "+" LIMIT " + (page-1)*size+","+size;
        List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
        logger.info(taskPatientDetailDOS.toString()+""+taskPatientDetailDOS.size());
        for (int i = 0;taskPatientDetailDOS != null&&taskPatientDetailDOS.size()!=0 && i<taskPatientDetailDOS.size();i++){
            TaskPatientDetailDO taskPatientDetailDO = taskPatientDetailDOS.get(i);
            String accountSql = "select * from wlyy_health_bank_account where patient_id = '"+taskPatientDetailDO.getPatientId()+"'";
            List<AccountDO> accountDOS = jdbcTemplate.query(accountSql,new BeanPropertyRowMapper(AccountDO.class));
            if (taskPatientDetailDOS.get(i).getPatientId().equalsIgnoreCase(patientId)){
                /*String taskSql = "select count(1)+1 as total from (" +
                        "select *  from (SELECT " +
                        " SUM(ptpd.total) AS total, " +
                        " ptpd.patient_openid AS patient_openid, " +
                        " ptpd.task_id AS task_id, " +
                        " ptpd.activity_id AS activity_id, " +
                        " ptpd.create_time as create_time, " +
                        " ptpd.patient_id AS patient_id " +
                        " FROM " +
                        " wlyy_health_bank_task_patient_detail ptpd " +
                        " WHERE " +
                        " activity_id = '" + activityId + "')ptpd1 where" +
                        " ptpd1.patient_id = '"+patientId+"' AND ptpd1.total > "+taskPatientDetailDOS.get(i).getTotal()+") ptpd2";
                List<Map<String,Object>> rstotal1 = jdbcTemplate.queryForList(taskSql);
                Long count = 0L;
                if(rstotal1!=null&&rstotal1.size()>0){
                    count = (Long) rstotal1.get(0).get("total");
                }
                accountDOS.get(0).setActivityRanking(count);*/
                taskPatientDetailDO.setIsFlag(1);
            }else {
                taskPatientDetailDO.setIsFlag(0);
            }
            taskPatientDetailDO.setAccountDO(accountDOS.get(0));
        }
        String sqlCount =  "SELECT " +
                " count(1) AS total " +
                "FROM " +
                " ( " +
                " SELECT " +
                " SUM(ptpd.total) AS total, " +
                " ptpd.patient_openid AS patient_openid, " +
                " ptpd.task_id AS task_id, " +
                " ptpd.activity_id AS activity_id, " +
                " ptpd.create_time as create_time, " +
                " ptpd.patient_id AS patient_id " +
                " FROM " +
                " wlyy_health_bank_task_patient_detail ptpd " +
                " WHERE " +
                " activity_id = '" + activityId+
                "' GROUP BY " +
                " patient_openid " +
                " ORDER BY ptpd.create_time DESC " +
                " )btpd1 " +
                " ORDER BY btpd1.total DESC ";
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlCount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return Envelop.getSuccessListWithPage(HealthBankMapping.api_success, taskPatientDetailDOS,page,size,count);
    }
    /**
     * 医生主动加分
     *
     * @param array 居民信息集合
     *
     * @param ruleId 规则id
     * @return
     */
    public Envelop<Boolean> doctorAddIntegrate(JSONArray array, String ruleId, String description) throws Exception {
        Envelop<Boolean> envelop = new Envelop<>();
        for (int i=0;i<array.size();i++){
            TaskRuleDO taskRuleDO = taskRuleDao.findOne(ruleId);
            JSONObject object = array.getJSONObject(i);
            String patientId = object.getString("code");
            String idCard = object.getString("idcard");
            String unionId = object.getString("unionid");
            String openId = object.getString("openid");
            String hospital = object.getString("hospital");
            String hospitalName = object.getString("hospitalName");
            String taskSql = "select * from wlyy_health_bank_task bt where type = 'RULE_TASK' AND transaction_id = '"+ruleId +"'";
            List<TaskDO> taskDOList = jdbcTemplate.query(taskSql,new BeanPropertyRowMapper(TaskDO.class));
            TaskDO taskDO1 = new TaskDO();
            if (taskDOList.isEmpty() && taskDOList.size() == 0){
                TaskDO taskDO = new TaskDO();
                taskDO.setTransactionId(taskRuleDO.getId());
                taskDO.setTaskCode("RULE");
                taskDO.setStatus(1);
                taskDO.setRuleCode(taskRuleDO.getId());
                taskDO.setType("RULE_TASK");
                taskDO.setCreateTime(new Date());
                taskDO.setUpdateTime(new Date());
                taskDO.setPeriod(taskRuleDO.getPeriod());
                taskDO.setSaasId("dev");
                taskDO.setTitle(taskRuleDO.getDescription());
                taskDO.setContent(taskRuleDO.getDescription());
                taskDO1 = taskDao.save(taskDO);
            }else {
                taskDO1 = taskDOList.get(0);
            }
            if (taskRuleDO.getPeriod() == 1){
                    String sql = "select * from wlyy_health_bank_task_patient_detail where patient_id = '"+patientId+"'AND task_id ='"+taskDO1.getId()+"'";
                    List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
                    if (taskPatientDetailDOS != null && taskPatientDetailDOS.size() != 0){
                        throw new Exception("已奖励过");
                    }
            }else if (taskRuleDO.getPeriod() == 0){
                    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
                    Date date = new Date();
                    String date1 = dateFormat.format(date);
                    String begin = DateUtils.getMinMonthDate(date1);
                    String end = DateUtils.getMaxMonthDate(date1);
                    String sql = "select * from wlyy_health_bank_task_patient_detail where patient_id = '"+patientId+"'AND task_id ='"+taskDO1.getId()+"' AND create_time > '"+begin+"' AND create_time < '"+end+"'";
                    List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
                    if (taskPatientDetailDOS != null && taskPatientDetailDOS.size() != 0){
                        throw new Exception("已奖励过");
                    }
            }
            String sql1 = "select * from wlyy_health_bank_task_patient_detail where task_id = '"+taskDO1.getId()+"' " +
                    "AND patient_idcard = '"+idCard+"' AND patient_openid = '"+openId+"' AND union_id = '"+unionId+"'";
            List<TaskPatientDetailDO> taskPatientDetailDOS = jdbcTemplate.query(sql1,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
            TaskPatientDetailDO taskPatientDetailDO1 = new TaskPatientDetailDO();
            if (taskPatientDetailDOS.isEmpty() && taskPatientDetailDOS.size() == 0){
                TaskPatientDetailDO taskPatientDetailDO = new TaskPatientDetailDO();
                taskPatientDetailDO.setStatus(1);
                taskPatientDetailDO.setTotal(Long.parseLong("0"));
                taskPatientDetailDO.setPatientId(patientId);
                taskPatientDetailDO.setPatientOpenid(openId);
                taskPatientDetailDO.setPatientIdcard(idCard);
                taskPatientDetailDO.setUnionId(unionId);
                taskPatientDetailDO.setSaasId("dev");
                taskPatientDetailDO.setCreateTime(new Date());
                taskPatientDetailDO.setUpdateTime(new Date());
                taskPatientDetailDO.setTaskId(taskDO1.getId());
                taskPatientDetailDO1 = taskPatientDetailDao.save(taskPatientDetailDO);
            }else {
                taskPatientDetailDO1 = taskPatientDetailDOS.get(0);
            }
            String sql = "select * from wlyy_health_bank_account where patient_id = '"+patientId+"'";
            List<AccountDO> accountDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(AccountDO.class));
            if (taskRuleDO.getTradeDirection() == -1 && taskRuleDO.getIntegrate() == 0){
                String integrateSql = "select * from wlyy_health_bank_credits_detail where patient_id = '"+patientId+"' " +
                        "AND transaction_id IN (SELECT id FROM wlyy_health_bank_task WHERE task_code IN ('BP_BIND','GLU_BIND','BP_MEASURE','GLU_MEASURE','RULE'))";
                List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(integrateSql,new BeanPropertyRowMapper(CreditsDetailDO.class));
                for (CreditsDetailDO creditsDetailDO:creditsDetailDOS){
                    if (creditsDetailDO.getTradeDirection()==1&&creditsDetailDO.getStatus()!=0){
                        AccountDO accountDO = accountDOS.get(0);
                        int total = accountDO.getTotal() - creditsDetailDO.getIntegrate();
                        creditsDetailDO.setStatus(0);
                        creditsDetailDO.setDescription(description);
                        credittsLogDetailDao.save(creditsDetailDO);
                        accountDO.setTotal(total);
                        accountDao.save(accountDO);
                    }
                }
                CreditsDetailDO creditsDetailDO1 = new CreditsDetailDO();
                creditsDetailDO1.setStatus(1);
                creditsDetailDO1.setSaasId("dev");
                creditsDetailDO1.setAccountId(accountDOS.get(0).getId());
                creditsDetailDO1.setHospital(hospital);
                creditsDetailDO1.setHospitalName(hospitalName);
                creditsDetailDO1.setPatientId(patientId);
                creditsDetailDO1.setIntegrate(taskRuleDO.getIntegrate());
                creditsDetailDO1.setTradeDirection(taskRuleDO.getTradeDirection());
                creditsDetailDO1.setDescription(description);
                creditsDetailDO1.setCreateTime(new Date());
                creditsDetailDO1.setUpdateTime(new Date());
                creditsDetailDO1.setTransactionId(taskDO1.getId());
                creditsDetailDO1.setTradeType("ACTIVITY_TASK");
                credittsLogDetailDao.save(creditsDetailDO1);
            }else{
                CreditsDetailDO creditsDetailDO = new CreditsDetailDO();
                creditsDetailDO.setStatus(1);
                creditsDetailDO.setSaasId("dev");
                creditsDetailDO.setAccountId(accountDOS.get(0).getId());
                creditsDetailDO.setHospital(hospital);
                creditsDetailDO.setHospitalName(hospitalName);
                creditsDetailDO.setPatientId(patientId);
                creditsDetailDO.setIntegrate(taskRuleDO.getIntegrate());
                creditsDetailDO.setTradeDirection(taskRuleDO.getTradeDirection());
                creditsDetailDO.setDescription(description);
                creditsDetailDO.setCreateTime(new Date());
                creditsDetailDO.setUpdateTime(new Date());
                creditsDetailDO.setTransactionId(taskDO1.getId());
                creditsDetailDO.setTradeType("ACTIVITY_TASK");
                credittsLogDetailDao.save(creditsDetailDO);
                if (taskRuleDO.getTradeDirection() == -1){
                    String integrateSql = "select * from wlyy_health_bank_credits_detail where patient_id = '"+patientId+"' " +
                            "AND transaction_id IN (SELECT id FROM wlyy_health_bank_task WHERE task_code IN ('BP_BIND','GLU_BIND','BP_MEASURE','GLU_MEASURE','RULE'))";
                    List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(integrateSql,new BeanPropertyRowMapper(CreditsDetailDO.class));
                    for (CreditsDetailDO creditsDetailDO1:creditsDetailDOS){
                        if (creditsDetailDO1.getTradeDirection()==1&&creditsDetailDO1.getStatus()!=0){
                            AccountDO accountDO = accountDOS.get(0);
                            int total = accountDO.getTotal() - creditsDetailDO1.getIntegrate();
                            creditsDetailDO1.setStatus(0);
                            creditsDetailDO1.setDescription(description);
                            credittsLogDetailDao.save(creditsDetailDO1);
                            accountDO.setTotal(total);
                            accountDao.save(accountDO);
                        }
                    }
                }else if (taskRuleDO.getTradeDirection() == 1){
                    AccountDO accountDO = accountDOS.get(0);
                    accountDO.setTotal(accountDO.getTotal() + taskRuleDO.getIntegrate());
                    accountDao.save(accountDO);
                }
            }
        }
        envelop.setObj(true);
        return envelop;
    }
    /**
     * 固定数据
     *
     * @param
     * @return
     *//*
    public List<TaskDO> getTasks(String patientId){
        List<TaskDO> taskDOList = new ArrayList<>();
        TaskDO taskDO = new TaskDO();
        taskDO.setPatientId(patientId);
        *//*taskDO.setPatientId(patientId);*//*
        taskDO.setTaskCode("BIND");
        taskDO.setPeriod(1);
        taskDO.setTaskTitle("首次绑定");
@ -301,7 +732,7 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
        taskDO.setUpdateTime(new Date());
        taskDOList.add(taskDO);
        TaskDO taskDO1 = new TaskDO();
        taskDO1.setPatientId(patientId);
        *//*taskDO1.setPatientId(patientId);*//*
        taskDO1.setTaskCode("MEASURE");
        taskDO1.setPeriod(0);
        taskDO1.setTaskTitle("每日测量");
@ -313,5 +744,170 @@ public class CreditsDetailService extends BaseJpaService<CreditsDetailDO,Creditt
        taskDOList.add(taskDO1);
        return taskDOList;
    }
*/
    public Envelop<CreditsDetailDO> stepAddIntegrate(CreditsDetailDO creditsDetailDO){
        try {
            synchronized (creditsDetailDO.getPatientId()){
                String sqlAccount = "select * from wlyy_health_bank_account ba where ba.patient_id = '"+creditsDetailDO.getPatientId() +"'";
                List<AccountDO> accountDOList = jdbcTemplate.query(sqlAccount,new BeanPropertyRowMapper(AccountDO.class));
                if (accountDOList != null && accountDOList.size() != 0){
                    creditsDetailDO.setAccountId(accountDOList.get(0).getId());
                }else {
                    AccountDO accountDO1 = new AccountDO();
                    accountDO1.setPatientId(creditsDetailDO.getPatientId());
                    accountDO1.setSaasId("dev");
                    accountDO1.setTotal(0);
                    accountDO1.setAccountName(creditsDetailDO.getName());
                    if(creditsDetailDO.getIdCard().length()>=4){// 判断是否长度大于等于4
                        String cardNumber=creditsDetailDO.getIdCard().substring(creditsDetailDO.getIdCard().length()- 4,creditsDetailDO.getIdCard().length());//截取两个数字之间的部分
                        int random = (int)((Math.random()*9+1)*100000);
                        accountDO1.setCardNumber(cardNumber+Integer.toString(random));
                    }
                    accountDO1.setHospital(creditsDetailDO.getHospital());
                    accountDO1.setPassword("123456");
                    accountDO1.setHospitalName(creditsDetailDO.getHospitalName());
                    accountDO1.setStatus(1);
                    accountDO1.setCreateTime(new Date());
                    accountDO1.setUpdateTime(new Date());
                    accountDao.save(accountDO1);
                    List<AccountDO> accountDOS = jdbcTemplate.query(sqlAccount,new BeanPropertyRowMapper(AccountDO.class));
                    creditsDetailDO.setAccountId(accountDOS.get(0).getId());
                }
                TaskDO taskDO = taskDao.findOne(creditsDetailDO.getTransactionId());
                String sql1 = "select *  from wlyy_health_bank_task_patient_detail where patient_openid = '"+creditsDetailDO.getOpenId()+"' " +
                        "AND patient_idcard = '"+creditsDetailDO.getIdCard()+"' AND union_id = '"+creditsDetailDO.getUnionId()+"' AND task_id = '"+creditsDetailDO.getTransactionId()+"'";
                List<TaskPatientDetailDO> taskPatientDetailDOList = jdbcTemplate.query(sql1,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
                TaskPatientDetailDO taskPatientDetailDO = taskPatientDetailDOList.get(0);
                String sql = "select * from wlyy_health_bank_credits_detail where patient_id = '"+creditsDetailDO.getPatientId()+"' AND " +
                        "transaction_id = '"+creditsDetailDO.getTransactionId()+"' AND create_time > '"+DateUtils.getDayBegin() +"' AND" +
                        " create_time < '"+DateUtils.getDayEnd()+"'";
                List<CreditsDetailDO> creditsDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper<>(CreditsDetailDO.class));
                String step = redisTemplate.opsForValue().get(STEP);
                if (StringUtils.isEmpty(step)){
                    throw new Exception("获取步数失败!");
                }
                JSONObject object = JSONObject.parseObject(step);
                int step1 = object.getInteger("step1");
                int step2 = object.getInteger("step2");
                int step3 = object.getInteger("step3");
                if (creditsDetailDOS != null && creditsDetailDOS.size() != 0){
                    CreditsDetailDO creditsDetailDO1 = creditsDetailDOS.get(0);
                    TaskRuleDO taskRuleDO = taskRuleDao.findOne(taskDO.getRuleCode());
                    if (creditsDetailDO.getStepNumber() == step1){
                        creditsDetailDO1.setIntegrate(1);
                        creditsDetailDO1.setTradeDirection(1);
                        CreditsDetailDO creditsDetailDO2 = credittsLogDetailDao.save(creditsDetailDO1);
                        AccountDO accountDO = accountDao.findOne(creditsDetailDO2.getAccountId());
                        accountDO.setTotal(accountDO.getTotal()+creditsDetailDO2.getIntegrate());
                        AccountDO accountDO1 = accountDao.save(accountDO);
                        creditsDetailDO2.setTotal(accountDO1.getTotal());
                        taskPatientDetailDO.setTotal(taskPatientDetailDO.getTotal()+creditsDetailDO2.getIntegrate());
                        taskPatientDetailDao.save(taskPatientDetailDO);
                        creditsDetailDOS.clear();
                        creditsDetailDOS.add(creditsDetailDO2);
                    }else if (creditsDetailDO.getStepNumber() == step2){
                        creditsDetailDO1.setIntegrate(creditsDetailDO1.getIntegrate()+2);
                        creditsDetailDO1.setTradeDirection(1);
                        CreditsDetailDO creditsDetailDO2 = credittsLogDetailDao.save(creditsDetailDO1);
                        AccountDO accountDO = accountDao.findOne(creditsDetailDO2.getAccountId());
                        accountDO.setTotal(accountDO.getTotal()+(creditsDetailDO2.getIntegrate()-1));
                        AccountDO accountDO1 = accountDao.save(accountDO);
                        creditsDetailDO2.setTotal(accountDO1.getTotal());
                        taskPatientDetailDO.setTotal(taskPatientDetailDO.getTotal()+(creditsDetailDO2.getIntegrate()-1));
                        taskPatientDetailDao.save(taskPatientDetailDO);
                        creditsDetailDOS.clear();
                        creditsDetailDOS.add(creditsDetailDO2);
                    }else if (creditsDetailDO.getStepNumber() == step3){
                        if (creditsDetailDO1.getIntegrate() == 1){
                            creditsDetailDO1.setIntegrate(creditsDetailDO1.getIntegrate()+7);
                            creditsDetailDO1.setTradeDirection(1);
                            CreditsDetailDO creditsDetailDO2 = credittsLogDetailDao.save(creditsDetailDO1);
                            AccountDO accountDO = accountDao.findOne(creditsDetailDO2.getAccountId());
                            accountDO.setTotal(accountDO.getTotal()+(creditsDetailDO2.getIntegrate()-1));
                            AccountDO accountDO1 = accountDao.save(accountDO);
                            creditsDetailDO2.setTotal(accountDO1.getTotal());
                            taskPatientDetailDO.setTotal(taskPatientDetailDO.getTotal()+(creditsDetailDO2.getIntegrate()-1));
                            taskPatientDetailDao.save(taskPatientDetailDO);
                            creditsDetailDOS.clear();
                            creditsDetailDOS.add(creditsDetailDO2);
                        }else if(creditsDetailDO1.getIntegrate() == 3){
                            creditsDetailDO1.setIntegrate(creditsDetailDO1.getIntegrate()+5);
                            creditsDetailDO1.setTradeDirection(1);
                            CreditsDetailDO creditsDetailDO2 = credittsLogDetailDao.save(creditsDetailDO1);
                            AccountDO accountDO = accountDao.findOne(creditsDetailDO2.getAccountId());
                            accountDO.setTotal(accountDO.getTotal()+(creditsDetailDO2.getIntegrate()-3));
                            AccountDO accountDO1 = accountDao.save(accountDO);
                            creditsDetailDO2.setTotal(accountDO1.getTotal());
                            taskPatientDetailDO.setTotal(taskPatientDetailDO.getTotal()+(creditsDetailDO2.getIntegrate()-3));
                            taskPatientDetailDao.save(taskPatientDetailDO);
                            creditsDetailDOS.clear();
                            creditsDetailDOS.add(creditsDetailDO2);
                        }
                    }
                }else{
                    CreditsDetailDO creditsDetailDO1 = new CreditsDetailDO();
                    if (creditsDetailDO.getStepNumber() == step1){
                        creditsDetailDO1.setIntegrate(1);
                        creditsDetailDO1.setTradeDirection(1);
                    }else if (creditsDetailDO.getStepNumber() == step2){
                        creditsDetailDO1.setIntegrate(3);
                        creditsDetailDO1.setTradeDirection(1);
                    }else if (creditsDetailDO.getStepNumber() == step3){
                        creditsDetailDO1.setIntegrate(8);
                        creditsDetailDO1.setTradeDirection(1);
                    }
                    creditsDetailDO1.setSaasId("dev");
                    creditsDetailDO1.setTradeType("ACTIVITY_TASK");
                    creditsDetailDO1.setPatientId(creditsDetailDO.getPatientId());
                    creditsDetailDO1.setHospital(creditsDetailDO.getHospital());
                    creditsDetailDO1.setHospitalName(creditsDetailDO.getHospitalName());
                    creditsDetailDO1.setAccountId(creditsDetailDO.getAccountId());
                    creditsDetailDO1.setStatus(1);
                    creditsDetailDO1.setCreateTime(new Date());
                    creditsDetailDO1.setUpdateTime(new Date());
                    creditsDetailDO1.setTransactionId(taskPatientDetailDO.getTaskId());
                    CreditsDetailDO creditsDetailDO2 = credittsLogDetailDao.save(creditsDetailDO1);
                    AccountDO accountDO = accountDao.findOne(creditsDetailDO2.getAccountId());
                    accountDO.setTotal(accountDO.getTotal()+creditsDetailDO2.getIntegrate());
                    taskPatientDetailDO.setTotal(taskPatientDetailDO.getTotal()+creditsDetailDO2.getIntegrate());
                    taskPatientDetailDao.save(taskPatientDetailDO);
                    creditsDetailDO2.setTotal(accountDO.getTotal());
                    creditsDetailDOS.add(creditsDetailDO2);
                }
                try{
                    activeRecordService.insert("dev",creditsDetailDOS.get(0).getTransactionId(),null,null,null,creditsDetailDOS.get(0).getPatientId());
                }catch (Exception e){
                    logger.error("插入活跃出错:"+e.getMessage());
                }
                Envelop<CreditsDetailDO> envelop = new Envelop<>();
                envelop.setDetailModelList(creditsDetailDOS);
                return envelop;
            }
        }catch (Exception e){
            e.printStackTrace();
            Envelop<CreditsDetailDO> envelop = new Envelop<>();
            return envelop;
        }
    }
  /*  public JSONObject getStepNumber(){
        String step = redisTemplate.opsForValue().get(STEP);
        logger.info("redis数据:"+step);
        String sql = ""
        String step1 = systemDictDao.
        logger.info("数据库的数据:"+step1);
        if (step != null && step.equalsIgnoreCase(step1)){
            JSONObject jsonObject = JSONObject.parseObject(step);
            logger.info("数据不一致:"+jsonObject.toString());
            return jsonObject;
        }else {
            JSONObject jsonObject = JSONObject.parseObject(step);
            redisTemplate.opsForValue().set(STEP,step1);
            logger.info("数据一致:"+jsonObject.toString());
            return jsonObject;
        }
    }*/
}

+ 15 - 15
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/TaskDetailService.java

@ -4,8 +4,8 @@ package com.yihu.jw.service;/**
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.dao.CredittsLogDetailDao;
import com.yihu.jw.dao.TaskDetailDao;
import com.yihu.jw.entity.health.bank.TaskDetailDO;
import com.yihu.jw.dao.TaskPatientDetailDao;
import com.yihu.jw.entity.health.bank.TaskPatientDetailDO;
import com.yihu.jw.restmodel.common.Envelop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
@ -21,9 +21,9 @@ import java.text.ParseException;
 **/
@Service
@Transactional
public class TaskDetailService extends BaseJpaService<TaskDetailDO,TaskDetailDao> {
public class TaskDetailService extends BaseJpaService<TaskPatientDetailDO,TaskPatientDetailDao> {
    @Autowired
    private TaskDetailDao taskDetailDao;
    private TaskPatientDetailDao taskPatientDetailDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
@ -33,11 +33,11 @@ public class TaskDetailService extends BaseJpaService<TaskDetailDO,TaskDetailDao
    /**
     * 参与任务
     *
     * @param taskDetailDO
     * @param taskPatientDetailDO
     * @return
     */
    public Envelop<Boolean> insert(TaskDetailDO taskDetailDO){
        taskDetailDao.save(taskDetailDO);
    public Envelop<Boolean> insert(TaskPatientDetailDO taskPatientDetailDO){
        taskPatientDetailDao.save(taskPatientDetailDO);
        Envelop<Boolean> envelop = new Envelop<>();
        envelop.setObj(true);
        return envelop;
@ -48,8 +48,8 @@ public class TaskDetailService extends BaseJpaService<TaskDetailDO,TaskDetailDao
     * @param taskDetailDO
     * @return
     *//*
    public Envelop<Boolean> insert(TaskDetailDO taskDetailDO){
        taskDetailDao.save(taskDetailDO);
    public Envelop<Boolean> insert(TaskPatientDetailDO taskDetailDO){
        taskPatientDetailDao.save(taskDetailDO);
        Envelop<Boolean> envelop = new Envelop<>();
        envelop.setObj(true);
        return envelop;
@ -64,12 +64,12 @@ public class TaskDetailService extends BaseJpaService<TaskDetailDO,TaskDetailDao
     * @return
     * @throws ParseException
     *//*
    public Envelop<TaskDetailDO> findTaskByPatient(String patientId, String doctorId, Integer page, Integer size) throws ParseException {
        TaskDetailDO taskDetailDO = new TaskDetailDO();
    public Envelop<TaskPatientDetailDO> findTaskByPatient(String patientId, String doctorId, Integer page, Integer size) throws ParseException {
        TaskPatientDetailDO taskDetailDO = new TaskPatientDetailDO();
        taskDetailDO.setDoctorId(doctorId);
        taskDetailDO.setPatientId(patientId);
        String sql = new ISqlUtils().getSql(taskDetailDO,page,size,"*");
        List<TaskDetailDO> taskDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskDetailDO.class));
        List<TaskPatientDetailDO> taskDetailDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskPatientDetailDO.class));
        String sqlcount = new ISqlUtils().getSql(taskDetailDO,0,0,"count");
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
@ -86,11 +86,11 @@ public class TaskDetailService extends BaseJpaService<TaskDetailDO,TaskDetailDao
     * @param taskDetailDO
     * @return
     *//*
    public Envelop<Boolean> update(TaskDetailDO taskDetailDO){
        TaskDetailDO taskDetailDO1 = taskDetailDao.findOne(taskDetailDO.getId());
    public Envelop<Boolean> update(TaskPatientDetailDO taskDetailDO){
        TaskPatientDetailDO taskDetailDO1 = taskPatientDetailDao.findOne(taskDetailDO.getId());
        String sql = "select cl.status as status,cl.total as total from health_bank_credits_log cl order by cl.update_time desc";
        List<CreditsDetailDO> creditsLogDetailDOList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(CreditsDetailDO.class));
        taskDetailDao.save(taskDetailDO);
        taskPatientDetailDao.save(taskDetailDO);
        if (taskDetailDO.getStatus().equalsIgnoreCase("finished")&&!taskDetailDO1.getStatus().equalsIgnoreCase("unfinished")){
            CreditsDetailDO creditsLogDetailDO = new CreditsDetailDO();
            if (creditsLogDetailDOList == null || creditsLogDetailDOList.size() ==0){

+ 86 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/TaskDictService.java

@ -0,0 +1,86 @@
package com.yihu.jw.service;/**
 * Created by nature of king on 2018/6/8.
 */
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.jw.dao.TaskDictDao;
import com.yihu.jw.entity.health.bank.TaskDictDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.health.bank.HealthBankMapping;
import com.yihu.jw.util.ISqlUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @author wangzhinan
 * @create 2018-06-08 15:47
 * @desc 字典 service
 **/
@Service
@Transactional
public class TaskDictService extends BaseJpaService<TaskDictDO,TaskDictDao> {
    @Autowired
    private TaskDictDao taskDictDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    /**
     * 查看任务字典
     *
     * @param taskDictDO 任务字典对象
     *
     * @param page 页码
     * @param size 分页大小
     * @return
     */
    public Envelop<TaskDictDO> selectByCondition(TaskDictDO taskDictDO, Integer page, Integer size){
        String sql = new ISqlUtils().getSql(taskDictDO,page,size,"*");
        List<TaskDictDO> taskDictDOS = jdbcTemplate.query(sql,new BeanPropertyRowMapper(TaskDictDO.class));
        String sqlcount = new ISqlUtils().getSql(taskDictDO,0,0,"count");
        List<Map<String,Object>> rstotal = jdbcTemplate.queryForList(sqlcount);
        Long count = 0L;
        if(rstotal!=null&&rstotal.size()>0){
            count = (Long) rstotal.get(0).get("total");
        }
        return Envelop.getSuccessListWithPage(HealthBankMapping.api_success, taskDictDOS,page,size,count);
    }
    /**
     * 添加任务字典
     *
     *
     * @param taskDictDO 任务字典对象
     * @return
     */
    public Envelop<Boolean> insert(TaskDictDO taskDictDO){
        taskDictDO.setCreateTime(new Date());
        taskDictDO.setUpdateTime(new Date());
        Envelop<Boolean> envelop = new Envelop<>();
        taskDictDao.save(taskDictDO);
        envelop.setObj(true);
        return envelop;
    }
    /**
     * 更新任务字典
     *
     * @param taskDictDO 任务字典对象
     * @return
     */
    public Envelop<Boolean> update(TaskDictDO taskDictDO){
        Envelop<Boolean> envelop = new Envelop<>();
        String sql =  ISqlUtils.getUpdateSql(taskDictDO);
        jdbcTemplate.update(sql);
        envelop.setObj(true);
        return envelop;
    }
}

+ 0 - 0
svr/svr-wlyy-health-bank/src/main/java/com/yihu/jw/service/TaskGoodsService.java


Alguns arquivos não foram mostrados porque muitos arquivos mudaram nesse diff