Browse Source

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

huangwenjie 7 years ago
parent
commit
0acadb90bc
33 changed files with 718 additions and 543 deletions
  1. 1 0
      common-lib/pom.xml
  2. 25 0
      common/common-rest-model/pom.xml
  3. 33 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/demo/TestSwagger.java
  4. 27 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/ListResult.java
  5. 29 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/PageResult.java
  6. 25 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/SimpleResult.java
  7. 40 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/BasePagingResponse.java
  8. 5 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/BaseResponse.java
  9. 38 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/ErrorResponse.java
  10. 28 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/FieldValidResponse.java
  11. 22 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/KeyValueResponse.java
  12. 27 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/KeyValueVo.java
  13. 13 3
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  14. 1 1
      patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml
  15. BIN
      patient-co/patient-co-wlyy/doc/技术文档/swagger/swagger文档生成.docx
  16. 58 0
      patient-co/patient-co-wlyy/pom.xml
  17. 45 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  18. 6 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/scheme/PatientSchemeListDao.java
  19. 13 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  20. 63 22
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionService.java
  21. 31 16
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java
  22. 29 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java
  23. 40 406
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  24. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java
  25. 21 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java
  26. 39 41
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java
  27. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java
  28. 5 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/scheme/PatientSchemeController.java
  29. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  30. 25 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/HealthEduArticlePatientModel.java
  31. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java
  32. 13 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  33. 7 0
      pom.xml

+ 1 - 0
common-lib/pom.xml

@ -18,6 +18,7 @@
    <modules>
        <!--公共的model-->
        <module>../common/common-entity</module>
        <module>../common/common-rest-model</module>
    </modules>
</project>

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

@ -0,0 +1,25 @@
<?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">
    <parent>
        <artifactId>common-lib</artifactId>
        <groupId>com.yihu</groupId>
        <version>1.0.0</version>
        <relativePath>../../common-lib/pom.xml</relativePath>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>common-rest-model</artifactId>
    <dependencies>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
        </dependency>
    </dependencies>
</project>

+ 33 - 0
common/common-rest-model/src/main/java/com.yihu.wlyy/rest/demo/TestSwagger.java

@ -0,0 +1,33 @@
package com.yihu.wlyy.rest.demo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * Created by chenweida on 2018/1/17.
 */
@ApiModel( description = "测试swagger生成")
public class TestSwagger {
    @ApiModelProperty("姓名")
    private String name;
    @ApiModelProperty("年龄")
    private Integer age;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getAge() {
        return age;
    }
    public void setAge(Integer age) {
        this.age = age;
    }
}

+ 27 - 0
common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/ListResult.java

@ -0,0 +1,27 @@
package com.yihu.wlyy.rest.model.common;
import com.yihu.wlyy.rest.model.common.base.BaseResponse;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "ListResult",description = "获取实体列表返回定义")
public class ListResult<T> extends BaseResponse {
    @ApiModelProperty("列表内容")
    private List<T> data;
    public ListResult(List<T> data) {
        this.data = data;
    }
    public List<T> getData() {
        return data;
    }
    public void setData(List<T> data) {
        this.data = data;
    }
}

+ 29 - 0
common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/PageResult.java

@ -0,0 +1,29 @@
package com.yihu.wlyy.rest.model.common;
import com.yihu.wlyy.rest.model.common.base.BasePagingResponse;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "PageResult<T>",description = "分页查询返回")
public class PageResult<T> extends BasePagingResponse {
    @ApiModelProperty("所有满足条件的实体")
    private List<T> data;
    public PageResult(int page, int size, long totalCount, List<T> data) {
        super(page, size, totalCount);
        this.data = data;
    }
    public List<T> getData() {
        return data;
    }
    public void setData(List<T> data) {
        this.data = data;
    }
}

+ 25 - 0
common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/SimpleResult.java

@ -0,0 +1,25 @@
package com.yihu.wlyy.rest.model.common;
import com.yihu.wlyy.rest.model.common.base.BaseResponse;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(description = "获取单个实体信息返回")
public class SimpleResult<T> extends BaseResponse {
    @ApiModelProperty("内容")
    private T data;
    public T getData() {
        return data;
    }
    public SimpleResult(T data) {
        this.data = data;
    }
    public void setData(T data) {
        this.data = data;
    }
}

+ 40 - 0
common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/BasePagingResponse.java

@ -0,0 +1,40 @@
package com.yihu.wlyy.rest.model.common.base;
import io.swagger.annotations.ApiModelProperty;
public abstract class BasePagingResponse extends BaseResponse {
    @ApiModelProperty("页大小")
    private int size;
    @ApiModelProperty("页码")
    private int page;
    @ApiModelProperty("总页数")
    private int totalPage;
    @ApiModelProperty("总数量")
    private long totalCount;
    public BasePagingResponse(int page, int size, long totalCount) {
        this.page = page;
        this.size = size;
        this.totalPage = size == 0 ? 1 : (int) Math.ceil((double) totalCount / (double) size);
        this.totalCount = totalCount;
    }
    public int getSize() {
        return size;
    }
    public int getPage() {
        return page;
    }
    public int getTotalPage() {
        return totalPage;
    }
    public long getTotalCount() {
        return totalCount;
    }
}

+ 5 - 0
common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/BaseResponse.java

@ -0,0 +1,5 @@
package com.yihu.wlyy.rest.model.common.base;
public abstract class BaseResponse extends ErrorResponse {
}

+ 38 - 0
common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/ErrorResponse.java

@ -0,0 +1,38 @@
package com.yihu.wlyy.rest.model.common.base;
import io.swagger.annotations.ApiModelProperty;
public class ErrorResponse {
    @ApiModelProperty("错误代码")
    private int status;
    @ApiModelProperty("错误消息")
    private String msg;
    @ApiModelProperty("返回时间戳")
    private long timestamp;
    public int getStatus() {
        return status;
    }
    public void setStatus(int status) {
        this.status = status;
    }
    public String getMsg() {
        return msg;
    }
    public void setMsg(String msg) {
        this.msg = msg;
    }
    public long getTimestamp() {
        return timestamp;
    }
    public void setTimestamp(long timestamp) {
        this.timestamp = timestamp;
    }
}

+ 28 - 0
common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/FieldValidResponse.java

@ -0,0 +1,28 @@
package com.yihu.wlyy.rest.model.common.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "FieldValidResponse",description = "验证返回")
public class FieldValidResponse extends BaseResponse {
    @ApiModelProperty("是否通过,true:通过")
    private boolean valid;
    private FieldValidResponse(boolean valid) {
        this.valid = valid;
    }
    public boolean isValid() {
        return valid;
    }
    public static FieldValidResponse success() {
        return new FieldValidResponse(true);
    }
    public static FieldValidResponse fail() {
        return new FieldValidResponse(false);
    }
}

+ 22 - 0
common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/KeyValueResponse.java

@ -0,0 +1,22 @@
package com.yihu.wlyy.rest.model.common.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
@ApiModel(value = "KeyValueResponse",description = "选项返回")
public class KeyValueResponse extends BaseResponse {
    @ApiModelProperty("所有选项")
    private List<KeyValueVo> options;
    public KeyValueResponse(List<KeyValueVo> options) {
        this.options = options;
    }
    public List<KeyValueVo> getOptions() {
        return options;
    }
}

+ 27 - 0
common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/KeyValueVo.java

@ -0,0 +1,27 @@
package com.yihu.wlyy.rest.model.common.base;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ApiModel(value = "KeyValueVo", description = "选项定义,key-value")
public class KeyValueVo {
    @ApiModelProperty("key")
    private String key;
    @ApiModelProperty("value")
    private String value;
    public KeyValueVo(String key, String value) {
        this.key = key;
        this.value = value;
    }
    public String getKey() {
        return key;
    }
    public String getValue() {
        return value;
    }
}

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

@ -497,6 +497,8 @@ public class DeviceService {
            int bloodPressureBbnormalCount = 0;//血压异常次数
            int bloodSuggurBbnormalCount = 0;//血糖异常次数
            int stdbloodPressureBbnormalCount = 0;//血压次数
            int stdbloodSuggurBbnormalCount = 0;//血糖次数
            List<PatientHealthIndex> bloodPressurepatientHealthIndices = new ArrayList<>();
            List<PatientHealthIndex> bloodSuggurpatientHealthIndices = new ArrayList<>();
@ -504,6 +506,14 @@ public class DeviceService {
            bloodPressurepatientHealthIndices = patientHealthIndexDao.findByPatientAndTypeByPage(patientCode,2);
            bloodSuggurpatientHealthIndices = patientHealthIndexDao.findByPatientAndTypeByPage(patientCode,1);
            if(!bloodPressurepatientHealthIndices.isEmpty()){
                stdbloodPressureBbnormalCount = bloodPressurepatientHealthIndices.size();
            }
            if(!bloodSuggurpatientHealthIndices.isEmpty()){
                stdbloodSuggurBbnormalCount = bloodSuggurpatientHealthIndices.size();
            }
            for (PatientHealthIndex index1 : bloodPressurepatientHealthIndices) {
                if(index1.getStatus() != null && 1 == index1.getStatus()){
                    bloodPressureBbnormalCount++;
@ -535,19 +545,19 @@ public class DeviceService {
            //连续5次正常,修改用户为非预警状态
            if(StringUtils.isNotBlank(patientdisease)){
                if("1".equals(patientdisease)){
                    if(0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                    if(stdbloodPressureBbnormalCount==5&&0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                        patient.setStandardStatus(0);
                        //1.4.2加入重点关注逻辑
                        cancalTrackPatientByDoctor(patientCode);
                    }
                }else if("2".equals(patientdisease)){
                    if(0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                    if(stdbloodSuggurBbnormalCount==5&&0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                        patient.setStandardStatus(0);
                        //1.4.2加入重点关注逻辑
                        cancalTrackPatientByDoctor(patientCode);
                    }
                }else if( "1,2".equals(patientdisease) || "2,1".equals(patientdisease)){
                    if( 0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                    if(stdbloodSuggurBbnormalCount==5&&stdbloodPressureBbnormalCount==5&&0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                        patient.setStandardStatus(0);
                        //1.4.2加入重点关注逻辑
                        cancalTrackPatientByDoctor(patientCode);

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

@ -110,7 +110,7 @@ activemq:
  password: admin
  url: tcp://172.19.103.87:61616
  queue:
    healtHarticleQueue: healthArticleChannel_dev  #健康文章推送
    healtHarticleQueue: healthArticleChannel_test  #健康文章推送
  consumers:
    count: 10 #消费者集群数

BIN
patient-co/patient-co-wlyy/doc/技术文档/swagger/swagger文档生成.docx


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

@ -34,6 +34,11 @@
            <groupId>com.yihu</groupId>
            <artifactId>common-entity</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>common-rest-model</artifactId>
            <version>1.0.0</version>
        </dependency>
        <!--Spring boot family-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
@ -164,6 +169,16 @@
            <artifactId>springfox-swagger-ui</artifactId>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-staticdocs</artifactId>
            <version>2.6.1</version>
        </dependency>
        <dependency>
            <groupId>io.github.swagger2markup</groupId>
            <artifactId>swagger2markup</artifactId>
            <version>1.3.2</version>
        </dependency>
        <!--Swagger end -->
        <dependency>
@ -481,6 +496,49 @@
        <finalName>wlyy</finalName>
        <plugins>
            <plugin>
                <groupId>org.asciidoctor</groupId>
                <artifactId>asciidoctor-maven-plugin</artifactId>
                <version>${asciidoctor.maven.plugin.version}</version>
                <configuration>
                    <sourceDirectory>build</sourceDirectory>
                    <outputDirectory>build/asciidoc/${project.version}</outputDirectory>
                    <headerFooter>true</headerFooter>
                    <doctype>book</doctype>
                    <sourceHighlighter>coderay</sourceHighlighter>
                    <attributes>
                        <toc>left</toc>
                        <toclevels>3</toclevels>
                        <sectnums>true</sectnums>
                        <revnumber>${project.version}</revnumber>
                        <revdate>${maven.build.timestamp}</revdate>
                        <organization>厦门健康之路</organization>
                        <sourcedir>${project.build.sourceDirectory}</sourcedir>
                    </attributes>
                </configuration>
                <executions>
                    <execution>
                        <id>output-html</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>html5</backend>
                        </configuration>
                    </execution>
                    <execution>
                        <id>output-docbook</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>process-asciidoc</goal>
                        </goals>
                        <configuration>
                            <backend>docbook</backend>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <!--打成war包需要的配置-->
            <plugin>
                <groupId>org.springframework.boot</groupId>

+ 45 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java

@ -1,5 +1,11 @@
package com.yihu.wlyy.config;
import io.github.swagger2markup.GroupBy;
import io.github.swagger2markup.Language;
import io.github.swagger2markup.Swagger2MarkupConfig;
import io.github.swagger2markup.Swagger2MarkupConverter;
import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
import io.github.swagger2markup.markup.builder.MarkupLanguage;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.async.DeferredResult;
@ -12,6 +18,9 @@ import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.net.URL;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.List;
@ -201,4 +210,40 @@ public class SwaggerConfig {
        return apiInfo;
    }
    /**
     * 生成html文章专用
     *
     private static final String Doctor_API = "doctor";
     private static final String Patient_API = "patient";
     private static final String Other_API = "other";
     private static final String GateWay_API = "gateway";
     * @param args
     * @throws Exception
     */
    public static void main(String[] args) throws Exception {
        String groupName="doctor";
        //String groupName="patient";
        //String groupName="other";
        // String groupName="gateway";
        URL remoteSwaggerFile = new URL("http://127.0.0.1:8080//v2/api-docs?group="+groupName);
        Path outputFile = Paths.get("patient-co/patient-co-wlyy/build/"+groupName);
        Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
                .withMarkupLanguage(MarkupLanguage.ASCIIDOC)
                .withOutputLanguage(Language.ZH)
                .withPathsGroupedBy(GroupBy.TAGS)
                .withGeneratedExamples()
                .withoutInlineSchema()
                .withBasePathPrefix()
                .build();
        Swagger2MarkupConverter converter = Swagger2MarkupConverter.from(remoteSwaggerFile)
                .withConfig(config)
                .build();
        converter.toFile(outputFile);
    }
}

+ 6 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/scheme/PatientSchemeListDao.java

@ -6,6 +6,8 @@ import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * 监测方案关联关系表
 * @author huangwenjie
@ -18,4 +20,8 @@ public interface PatientSchemeListDao extends
    @Modifying
    @Query("delete PatientSchemeList where patientcode=?1 and type=?2")
    void delByPatientCode(String patientcode, int i);
    List<PatientSchemeList> findByPatientcodeAndSchemecodeAndType(String patientcode,String schemecode,Integer type);
    List<PatientSchemeList> findBySchemecode(String schemecode);
}

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

@ -837,6 +837,8 @@ public class PatientHealthIndexService extends BaseService {
        int bloodPressureBbnormalCount = 0;//血压异常次数
        int bloodSuggurBbnormalCount = 0;//血糖异常次数
        int stdbloodPressureBbnormalCount = 0;//血压次数
        int stdbloodSuggurBbnormalCount = 0;//血糖次数
        List<DevicePatientHealthIndex> bloodPressurepatientHealthIndices = new ArrayList<>();
        List<DevicePatientHealthIndex> bloodSuggurpatientHealthIndices = new ArrayList<>();
@ -844,6 +846,14 @@ public class PatientHealthIndexService extends BaseService {
        bloodPressurepatientHealthIndices = patientHealthIndexDao.findByPatientAndTypeByPage(patientCode, 2);
        bloodSuggurpatientHealthIndices = patientHealthIndexDao.findByPatientAndTypeByPage(patientCode, 1);
        if(!bloodPressurepatientHealthIndices.isEmpty()){
            stdbloodPressureBbnormalCount = bloodPressurepatientHealthIndices.size();
        }
        if(!bloodSuggurpatientHealthIndices.isEmpty()){
            stdbloodSuggurBbnormalCount = bloodSuggurpatientHealthIndices.size();
        }
        for (DevicePatientHealthIndex index1 : bloodPressurepatientHealthIndices) {
            if (index1.getStatus() != null && 1 == index1.getStatus()) {
                bloodPressureBbnormalCount++;
@ -877,19 +887,19 @@ public class PatientHealthIndexService extends BaseService {
	    //连续5次正常,修改用户为非预警状态
	    if (StringUtils.isNotBlank(patientdisease)) {
		    if ("1".equals(patientdisease)) {
			    if (0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
			    if (stdbloodPressureBbnormalCount==5&&0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
				    p.setStandardStatus(0);
                    //1.4.2加入重点关注逻辑
                    cancalTrackPatientByDoctor(patientCode);
			    }
		    } else if ("2".equals(patientdisease)) {
			    if (0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
			    if (stdbloodSuggurBbnormalCount==5&&0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
				    p.setStandardStatus(0);
                    //1.4.2加入重点关注逻辑
                    cancalTrackPatientByDoctor(patientCode);
			    }
		    } else if ("1,2".equals(patientdisease) || "2,1".equals(patientdisease)) {
			    if (0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
			    if (stdbloodPressureBbnormalCount==5&&stdbloodSuggurBbnormalCount==5&&0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())) {
				    p.setStandardStatus(0);
                    //1.4.2加入重点关注逻辑
                    cancalTrackPatientByDoctor(patientCode);

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

@ -410,11 +410,33 @@ public class PrescriptionService extends BaseService {
     * @param endTime
     * @return
     */
    public List<Map<String,Object>> getPrescriptionByCondition(String level, String area, String disease, String status, String type, String startTime,String endTime,int pageNo, int pageSize){
    public JSONObject getPrescriptionByCondition(String level, String area, String disease, String status, String type, String startTime,String endTime,int pageNo, int pageSize){
        String sql = "SELECT p.code,p.patient_name,p.doctor_name,p.hospital_name,p.dispensary_type,p.status," +
        /*String sql = "SELECT p.code,p.patient_name,p.doctor_name,p.hospital_name,p.dispensary_type,p.status," +
                "p.create_time,GROUP_CONCAT(d.health_problem) AS health_problem, GROUP_CONCAT(d.health_problem_name) AS health_problem_name " +
                "FROM wlyy_prescription p LEFT JOIN wlyy_prescription_diagnosis d ON p.code = d.prescription_code";
                "FROM wlyy_prescription p LEFT JOIN wlyy_prescription_diagnosis d ON p.code = d.prescription_code";*/
       JSONObject jsonObject = new JSONObject();
        String sql ="SELECT" +
                " p. CODE," +
                " p.patient_name," +
                " p.doctor_name," +
                " p.hospital_name," +
                " p.dispensary_type," +
                " p. STATUS," +
                " p.create_time," +
                " GROUP_CONCAT(d.health_problem) AS health_problem," +
                " GROUP_CONCAT(d.health_problem_name) AS health_problem_name," +
                " a.total_amount" +
                " FROM" +
                " wlyy_prescription p" +
                " LEFT JOIN wlyy_prescription_diagnosis d ON p. CODE = d.prescription_code" +
                " LEFT JOIN wlyy_prescription_pay a ON p. CODE = a.prescription_code" +
                " WHERE" +
                " IF (" +
                " p. STATUS > 50," +
                " a.trade_status = 1," +
                " 1 = 1" +
                ")";
        //判断疾病
        if(StringUtils.isNotBlank(disease)){
            if ("1".equals(disease)){
@ -422,9 +444,7 @@ public class PrescriptionService extends BaseService {
            }else if ("2".equals(disease)){
                disease = tnb;
            }
            sql += " WHERE d.health_problem ='"+disease+"' ";
        }else{
            sql +="  WHERE 1=1 ";
            sql += " and d.health_problem ='"+disease+"' ";
        }
        //判断状态
        if ("2".equals(status)){//已完成
@ -466,15 +486,25 @@ public class PrescriptionService extends BaseService {
        if (StringUtils.isNotBlank(startTime) && StringUtils.isNotBlank(endTime)){
            startTime += " 00:00:00";
            endTime += " 23:59:59";
            sql += " AND p.create_time <= ? " +
                    " AND p.create_time >= ? ";
            sql +=" GROUP BY p.code ORDER  BY p.create_time DESC limit ?,?";
            resultList = jdbcTemplate.queryForList(sql,new Object[]{endTime,startTime,start,pageSize});
        }else{
            sql +=" GROUP BY p.code ORDER  BY p.create_time DESC limit ?,?";
            resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
            sql += " AND p.create_time <= '" +endTime+"'"+
                    " AND p.create_time >= '"+startTime+"'";
        }
        sql +=" GROUP BY p.code ORDER  BY p.create_time DESC ";
        resultList = jdbcTemplate.queryForList(sql);
        jsonObject.put("count",resultList.size());
        double totalAmount = 0.0;
        for (Map<String,Object> map : resultList){
            if (map.get("total_amount")!=null){
                totalAmount += Double.valueOf(String.valueOf(map.get("total_amount")));
            }
        }
        return resultList;
        DecimalFormat df = new DecimalFormat("#.0");
        jsonObject.put("totalAmount",totalAmount>0?df.format(totalAmount/100.0):0.0);
        sql += " limit ?,?";
        resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
        jsonObject.put("list",resultList);
        return jsonObject;
    }
    /**
@ -482,7 +512,8 @@ public class PrescriptionService extends BaseService {
     * @param keyWord
     * @return
     */
    public List<Map<String,Object>> getPrescriptionByKeyWord(String keyWord,int pageNo,int pageSize){
    public JSONObject getPrescriptionByKeyWord(String keyWord,int pageNo,int pageSize){
        JSONObject jsonObject = new JSONObject();
        String sql = "SELECT" +
                " p. CODE," +
                " p.patient_name," +
@ -492,24 +523,34 @@ public class PrescriptionService extends BaseService {
                " p. STATUS," +
                " p.create_time," +
                " GROUP_CONCAT(d.health_problem) AS health_problem," +
                " GROUP_CONCAT(d.health_problem_name) AS health_problem_name"+
                " GROUP_CONCAT(d.health_problem_name) AS health_problem_name,"+
                " a.total_amount"+
                " FROM" +
                " wlyy_prescription p" +
                " LEFT JOIN wlyy_prescription_diagnosis d ON p. CODE = d.prescription_code" +
                //" LEFT JOIN wlyy_prescription_pay a ON p.code = a.prescription_code" +
                " LEFT JOIN wlyy_prescription_pay a ON p.code = a.prescription_code" +
                " WHERE" +
                " 1 = 1 " ;
                " IF(p.status>50,a.trade_status=1,1=1) " ;
        //判断关键字
        if (StringUtils.isNotBlank(keyWord)){
            sql += " AND (p.patient_name like '%"+keyWord+"%' or p.doctor_name like '%"+keyWord+"%')";
        }
        sql += " GROUP BY p.code ORDER  BY p.create_time DESC ";
        List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql);
        jsonObject.put("count",resultList.size());
        double totalAmount = 0L;
        for (Map<String,Object> map : resultList){
            if (map.get("total_amount")!=null){
                totalAmount += Double.valueOf(String.valueOf(map.get("total_amount")));
            }
        }
        DecimalFormat df = new DecimalFormat("#.0");
        jsonObject.put("totalAmount",totalAmount>0?df.format(totalAmount/100.0):0.0);
        sql+=" limit ?,?";
        int start = (pageNo-1)*pageSize;
        List<Map<String,Object>> resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
        return resultList;
        resultList = jdbcTemplate.queryForList(sql,new Object[]{start,pageSize});
        jsonObject.put("list",resultList);
        return jsonObject;
    }
    /**

+ 31 - 16
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java

@ -588,13 +588,17 @@ public class DoctorSchemeService extends BaseService{
    public void delDoctorScheme(String doctorcode, String schemecode, String type) throws Exception{
        if("1".equals(type)){
            doctroSchemeBloodSuggerDao.updateDelStatus(1,doctorcode,schemecode);
        }
        if("2".equals(type)){
            doctoreSchemeBloodPressureDao.updateDelStatus(1,doctorcode,schemecode);
        }
        List<PatientSchemeList> list = patientSchemeListDao.findBySchemecode(schemecode);
        if(list!=null&&list.size()>0){
            patientSchemeListDao.delete(list);
        }
    }
    public Map<String,Object> getPatientHealthIndex(String patient,String startDate,String endDate,String type){
@ -1287,10 +1291,8 @@ public class DoctorSchemeService extends BaseService{
                "    ( " +
                "     SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='"+doctor+"' AND p.team_code =" +teamCode+
                "    ) " +
                "  AND " +
                "  i.value1 <= p.sbp  " +
                "  AND  " +
                "  i.value1 >= p.sbp_min  " +
                "  AND i.value1 <= cast(p.sbp as SIGNED INTEGER) " +
                "  AND i.value1 >= cast(p.sbp_min as SIGNED INTEGER) "+
                "  AND i.del ='1'  " +
                "  AND i.type = 2   " +
                "  AND i.record_date >= '"+startDate+"' " +
@ -1380,9 +1382,9 @@ public class DoctorSchemeService extends BaseService{
                "     SELECT p.patient_code AS `user` FROM wlyy_track_patient p WHERE p.del='1' AND p.doctor_code='"+doctor+"' AND p.team_code =" +teamCode+
                "    ) " +
                "  AND " +
                "  i.value1 <= p.fbg  " +
                "  i.value1 <= cast(p.fbg as SIGNED INTEGER)  " +
                "  AND  " +
                "  i.value1 >= p.fbg_min  " +
                "  i.value1 >= cast(p.fbg_min as SIGNED INTEGER) " +
                "  AND i.value2 in("+value2+") " +
                "  AND i.del ='1'  " +
                "  AND i.type = 1   " +
@ -1950,30 +1952,43 @@ public class DoctorSchemeService extends BaseService{
        Map<String,Object> rs = new HashedMap();
        //1. 血糖2.血压
        if("1".equals(type)){
            List<DoctorSchemeBloodSugger> list =  doctroSchemeBloodSuggerDao.findByCode("default");
            String sql = " SELECT p.* FROM wlyy_doctor_scheme_blood_sugger p where p.code='default' and p.del=0 order by p.doctorcode,p.code desc,p.dayofweek asc";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            rs.put("code","default");
            rs.put("name",list.get(0).getName());
            rs.put("content",list.get(0).getContent());
            rs.put("name",list.get(0).get("name"));
            rs.put("content",list.get(0).get("content"));
            rs.put("list",list);
        }else{
            List<DoctorSchemeBloodPressure> list =  doctoreSchemeBloodPressureDao.findByCode("default");
            String sql = " SELECT p.* FROM wlyy_doctor_scheme_blood_pressure p where p.code='default' and p.del=0 order by p.doctorcode,p.code desc,p.dayofweek asc";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
            rs.put("code","default");
            rs.put("name",list.get(0).getName());
            rs.put("content",list.get(0).getContent());
            rs.put("name",list.get(0).get("name"));
            rs.put("content",list.get(0).get("content"));
            rs.put("list",list);
        }
        return rs;
    }
    @Transactional
    public String setPatientDefaultScheme(String patient,String type){
        PatientSchemeList pl = new PatientSchemeList();
        pl.setPatientcode(patient);
        pl.setCode(getCode());
        if("0".equals(type)){
        if("1".equals(type)){
            List<PatientSchemeList> list = patientSchemeListDao.findByPatientcodeAndSchemecodeAndType(patient,"default",1);
            if(list!=null&&list.size()>0){
                return "-1";
            }
            pl.setType(1);
        }else{
            List<PatientSchemeList> list = patientSchemeListDao.findByPatientcodeAndSchemecodeAndType(patient,"default",2);
            if(list!=null&&list.size()>0){
                return "-1";
            }
            pl.setType(2);
        }
        pl.setPatientcode(patient);
        pl.setCode(getCode());
        pl.setSchemecode("default");
        pl.setCreateTime(new Date());
        patientSchemeListDao.save(pl);

+ 29 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statistics/StatisticsService.java

@ -1,6 +1,5 @@
package com.yihu.wlyy.service.app.statistics;
import com.yihu.es.entity.HealthEduArticleES;
import com.yihu.es.entity.HealthEduArticleESResult;
import com.yihu.wlyy.entity.address.Town;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
@ -16,12 +15,8 @@ import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.statistics.PopulationBaseDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.util.*;
import io.swagger.models.auth.In;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.time.DateUtils;
import org.elasticsearch.common.inject.internal.Join;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -31,15 +26,14 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.nativejdbc.OracleJdbc4NativeJdbcExtractor;
import org.springframework.stereotype.Service;
import org.apache.commons.lang3.StringUtils;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
 * Created by lyr on 2016/08/16.
@ -2304,7 +2298,24 @@ public class StatisticsService extends BaseService {
            rs.put(map);
        }
        //健康教育排行
        String edurc_sql = "SELECT s.rowno AS articleRK FROM " +
        String adminTeamSql ="SELECT m.id FROM wlyy_admin_team m  WHERE m.org_code ='" + orgcode + "'";
        List<Map<String,Object>> adminTeamIds = jdbcTemplate.queryForList(adminTeamSql);
        String adminTeamIdsStr = adminTeamIds.stream().map(one->String.valueOf(one.get("id"))+",").collect(Collectors.joining());
        if (adminTeamIdsStr!= null && adminTeamIdsStr.length()>0){
            adminTeamIdsStr = adminTeamIdsStr.substring(0,adminTeamIdsStr.length()-1);
        }
        startDate = changeDate(startDate);
        endDate = changeDate(endDate);
        String es_edurc_sql ="SELECT count(*) number,adminTeamCode FROM "+esIndex+" where czrq > '"+startDate+"' and czrq < '"+endDate+"' and adminTeamCode in ("+adminTeamIdsStr+") GROUP BY adminTeamCode ORDER BY number DESC";
        List<Map<String, Object>> returnList = elasticsearchUtil.excuteDataModel(es_edurc_sql);
        int rk =0;
        for (Map<String, Object> map : returnList){
            if (Long.valueOf(String.valueOf(map.get("adminTeamCode"))).equals(id)) {
                rk = returnList.indexOf(map)+1;
                break;
            }
        }
        /*String edurc_sql = "SELECT s.rowno AS articleRK FROM " +
                "( " +
                " SELECT (@rowNum :=@rowNum + 1) AS rowno,t.count,t.admin_team_code " +
                " FROM ( " +
@ -2328,7 +2339,10 @@ public class StatisticsService extends BaseService {
            Map<String, Object> map = new HashMap<>();
            map.put("articleRK", 0);
            rs.put(map);
        }
        }*/
        Map<String, Object> map = new HashMap<>();
        map.put("articleRK", rk);
        rs.put(map);
        return rs;
    }
@ -2558,7 +2572,7 @@ public class StatisticsService extends BaseService {
        } else {
            //按月统计
            sql = "SELECT" +
                    " (DATE_FORMAT(c.create_time, '%v')- DATE_FORMAT('2017-12-01 00:00:00', '%v')+ 1)AS weekOfMonth, " +
                    " (DATE_FORMAT(c.create_time, '%v')- DATE_FORMAT('"+startDate+"', '%v')+ 1)AS weekOfMonth, " +
                    " COUNT(1)AS noRely " +
                    " FROM " +
                    " wlyy_admin_team_member m JOIN(" +
@ -2585,7 +2599,7 @@ public class StatisticsService extends BaseService {
                    " GROUP BY weekOfMonth";
            totalSql="SELECT" +
                    " (DATE_FORMAT(c.create_time, '%v')- DATE_FORMAT('2017-12-01 00:00:00', '%v')+ 1)AS weekOfMonth, " +
                    " (DATE_FORMAT(c.create_time, '%v')- DATE_FORMAT('"+startDate+"', '%v')+ 1)AS weekOfMonth, " +
                    " COUNT(1)AS total " +
                    " FROM " +
                    " wlyy_admin_team_member m JOIN(" +
@ -3119,7 +3133,7 @@ public class StatisticsService extends BaseService {
            //按月
            totalSQL = "SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('" + startDateStr + "', '%v') + 1 " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('" + startDate +" 17:00:00" + "', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS followupCount " +
                    " FROM " +
                    " wlyy_followup w " +
@ -3130,7 +3144,7 @@ public class StatisticsService extends BaseService {
                    " AND w.create_time <= '?2' ";
            planSQL = "SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('" + startDateStr + "', '%v') + 1 " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('" + startDate +" 17:00:00"  + "', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS planCount " +
                    " FROM " +
                    " wlyy_followup w " +
@ -3528,7 +3542,7 @@ public class StatisticsService extends BaseService {
            //查月份
            totalSql = "SELECT " +
                    "  ( " +
                    "  DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('" + startDateStr + "', '%v') + 1 " +
                    "  DATE_FORMAT(w.czrq, '%v') - DATE_FORMAT('" + startDate+" 17:00:00" + "', '%v') + 1 " +
                    " ) AS weekOfMonth,COUNT(1) AS reservationCount " +
                    " FROM " +
                    " wlyy_patient_reservation w " +
@ -3754,7 +3768,7 @@ public class StatisticsService extends BaseService {
            //按月统计
            SQL = "SELECT " +
                    " ( " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('" + startDateStr + "', '%v') + 1 " +
                    "  DATE_FORMAT(w.create_time, '%v') - DATE_FORMAT('" + startDate+" 17:00:00" + "', '%v') + 1 " +
                    " ) AS weekOfMonth, " +
                    " COUNT(1) AS guidanceCount " +
                    " FROM " +

+ 40 - 406
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -58,7 +58,7 @@ public class JMJkEduArticleService extends BaseService {
    private String esIndex;
    @Autowired
    private AdminTeamService adminTeamService;
    
    @Autowired
    private ElasticFactory elasticFactory;
    @Autowired
@ -143,10 +143,11 @@ public class JMJkEduArticleService extends BaseService {
        HealthEduArticlePatientModel heapm = null;
        JSONObject article = null;
        Doctor doctor = null;
    
        List<HealthEduArticlePatientModel> resultList = new ArrayList<>();
        StringBuffer sql3 = null;
        StringBuffer sql4 = null;
        for (HealthEduArticleES one : esList) {
@ -181,29 +182,45 @@ public class JMJkEduArticleService extends BaseService {
                heapm.setReadNumber(0L);
            }
            //备注:因为1.4.1前端的阅读数取值的参数是browseNumber,到1.4.2前端再做调整为ReadNumber
            if(!StringUtils.isEmpty(article.getString("browseNumber"))){
                heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
            }else{
                heapm.setBrowseNumbere(0);//文章浏览数
            }
//            if(num!=null){
//                heapm.setBrowseNumbere(Integer.valueOf(num.intValue()));//文章浏览数
//            }else{
//                heapm.setBrowseNumbere(0);//文章浏览数
//            }
            sql4 = new StringBuffer();
            sql4.append("SELECT COUNT(*) as num FROM "+esType+" WHERE  batchNo = '"+one.getBatchNo()+"' AND patientCode is not null AND articleId='"+article.getString("articleId")+"'");
//            sql4.append("SELECT COUNT(*) as num FROM "+esType+" WHERE  doctorCode='"+one.getDoctorCode()+"' AND patientCode is not null AND articleId='"+article.getString("articleId")+"'");
//            System.out.printf("AllCount:"+sql4.toString());
            Long num2 = elasticsearchUtil.excuteForLong(sql4.toString(), esType, esIndex);
            if(num2!=null){
                heapm.setAllCount(num2.intValue());//发送数
            }else{
                heapm.setAllCount(0);//发送数
            }
            if(!StringUtils.isEmpty(article.getString("commentNumber"))){
                heapm.setCommentNumber(Integer.valueOf(article.getString("commentNumber")));//文章评论数
            }else{
                heapm.setCommentNumber(0);//文章评论数
            }
            
            if(!StringUtils.isEmpty(article.getString("pointNumber"))){
                heapm.setPointNumber(Integer.valueOf(article.getString("pointNumber")));//文章点赞数
            }else{
                heapm.setPointNumber(0);//文章点赞数
            }
            if(!StringUtils.isEmpty(article.getString("collectionNumberCount"))){
                heapm.setCollectionNumber(Integer.valueOf(article.getString("collectionNumberCount")));//文章点赞数
            if(!StringUtils.isEmpty(article.getString("collectionNumber"))){
                heapm.setCollectionNumber(Integer.valueOf(article.getString("collectionNumber")));//文章点赞数
            }else{
                heapm.setCollectionNumber(0);//文章点赞数
            }
            
            heapm.setArticleCover(article.getString("articleCover"));//封面
            if(article.getString("insertTime")!=null){
                heapm.setComputeTime(computeTime(article.getString("insertTime")));
@ -307,137 +324,6 @@ public class JMJkEduArticleService extends BaseService {
    }
//    public String fetchUserHighestAuthority(List<Map<String, Object>> resultMap){
//        String result = "";
//        for(Map<String, Object> one:resultMap){
//            String role = one.get("roleCode").toString();
//            if(role.length()==6){
//                if("00".equals(role.substring(4))){
//                    return role;
//                }else {
//                    result = role;
//                }
//            }else{
//                if(result.length()==6){
//
//                }else{
//
//                }
//            }
//        }
//    }
//    /**
//     * 保存发送信息
//     *
//     * @param patientSet  患者set集和
//     * @param sendCode    发送人code、
//     * @param sendMessage 发送人携带的信息
//     * @param teamId      发送人所属团队
//     * @param articleId   文章列表
//     */
//    @Transactional
//    public HealthEduArticlePatient saveArticle(Set<String> patientSet,
//                                                  String sendCode,
////                                                  String sendName,
//                                                  Integer sendType,
//                                                  String sendMessage,
//                                                  Long teamId,
//                                                  String articleId,
//                                                  String leaveWords) throws Exception {
//
//
//        String batchNo = UUID.randomUUID().toString();
//        List<Patient> patientList = new ArrayList<>();
//
//        for (String patient : patientSet) {
//            patientList.add(new Patient(patient));
//        }
//        HealthEduArticlePatient healthEduArticlePatient = new HealthEduArticlePatient();
//        //1、医生,2、卫计委(管理员)
//        //如果是卫计委得区别角色
//        Doctor doctor = doctorDao.findByCode(sendCode);
//        String sendName = doctor.getName();
//        //管理员
//        Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(sendCode);
//        Integer level = (Integer)resultMap.get("level");
//        List<String> roleList = (List<String>)resultMap.get("roleList");
//        if(doctor.getLevel()==10&&sendType==2){
//            String resultSql ="";
//            String whereSql ="";
//            String temp = "";
//            for(String one :roleList){
//                temp+=",'"+one+"'";
//            }
//            if(!StringUtils.isEmpty(temp)){
//                temp=temp.substring(1);
//            }
//            switch (level){
//                case 1:{resultSql +=" DISTINCT (province_name) as name";
//                    whereSql+=" and province in ("+temp+")";break;}
//                case 2:{resultSql +=" DISTINCT (city_name) as name";
//                    whereSql+=" and city in ("+temp+")";break;}
//                case 3:{resultSql +=" DISTINCT (town_name) as name";
//                    whereSql+=" and town in ("+temp+")";break;}
//                case 4:{resultSql +=" DISTINCT (name) as name";
//                    whereSql+=" and code in ("+temp+")";break;}
//
//            }
//            String sql = "select "+resultSql+" from dm_hospital  where level=2 "+whereSql ;
//            List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
//            temp = "";
//            for(Map<String, Object> one :returnList){
//                temp +=","+one.get("name");
//            }
//            sendName = StringUtils.isEmpty(temp)?"":temp.substring(1);
//        }
//        List<RoleVo> roleVoLists= new ArrayList<>();
//        for(String one:roleList){
//            RoleVo roleVo = new RoleVo();
//            roleVo.setCode(one);
//            roleVoLists.add(roleVo);
//        }
//        healthEduArticlePatient.setRoleList(roleVoLists);
//        healthEduArticlePatient.setDoctorCode(sendCode);
//        healthEduArticlePatient.setSendName(sendName);
//        healthEduArticlePatient.setSendType(2);
//        healthEduArticlePatient.setAdminTeamCode(teamId);
//        healthEduArticlePatient.setLeaveWords(leaveWords);
//        if (doctor != null) {
//            healthEduArticlePatient.setDoctorName(doctor.getName());
//            healthEduArticlePatient.setHospital(doctor.getHospital());
//            healthEduArticlePatient.setHospitalName(doctor.getHospitalName());
//            healthEduArticlePatient.setTown(doctor.getTown());
//            healthEduArticlePatient.setTownName(doctor.getTownName());
//            healthEduArticlePatient.setSendLevel(doctor.getLevel() != null ? String.valueOf(doctor.getLevel()) : "");
//            healthEduArticlePatient.setSendPic(doctor.getPhoto());
//            healthEduArticlePatient.setSendSex(doctor.getSex() != null ? String.valueOf(doctor.getSex()) : "");
//        }
//        healthEduArticlePatient.setBatchNo(batchNo);
//        healthEduArticlePatient.setCreateTime(new Date());
//
//
//        //通过文章id 获取文章详情
//        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
//
//        healthEduArticlePatient.setArticleId(article.get("articleId") + "");
//        healthEduArticlePatient.setAttachedTitle(article.get("articleTitle") + "");
//        healthEduArticlePatient.setAttachedPic(article.get("articleCover") + "");
//        healthEduArticlePatient.setAttachedContent(article.get("articleContent") + "");
//        healthEduArticlePatient.setAttachedMessage(sendMessage);
//        healthEduArticlePatient.setArticleType(article.get("articleType") + "");
//        healthEduArticlePatient.setLevel(article.get("articlelevel") + "");
//        healthEduArticlePatient.setLevel1Type(article.get("firstLevelCategoryId") + "");
//        healthEduArticlePatient.setLevel2Type(article.get("secondLevelCategoryId") + "");
//        healthEduArticlePatient.setType("1");//文章
////        healthEduArticlePatient.setArticleUrl(articleBaseUrl+"JkEduWeb/web/jkEdu/articleDetail.html?behavior=4&articleId="+articleId+"&userId="+);
//        healthEduArticlePatient.setPatients(patientList);
//
//        //保存到ES中
//        elastricSearchSave.save(healthEduArticlePatient, esIndex, esType);
//        return healthEduArticlePatient;
//    }
    /**
     * 保存PC端发送信息
@ -461,83 +347,6 @@ public class JMJkEduArticleService extends BaseService {
                                                     String currentUserRoleLevel) throws Exception {
//        String batchNo = UUID.randomUUID().toString();
//        List<Patient> patientList = new ArrayList<>();
//
//        for (String patient : patientSet) {
//            patientList.add(new Patient(patient));
//        }
//        HealthEduArticlePatient healthEduArticlePatient = new HealthEduArticlePatient();
//
//        Doctor doctor = doctorDao.findByCode(sendCode);
//        String sendName = doctor.getName();
//        //1、普通医生,2、管理员
//        if(sendType==2){
//            String resultSql ="";
//            String whereSql ="";
//            switch (currentUserRoleLevel){
//                case "1":{resultSql +=" DISTINCT (province_name) as name";
//                    whereSql+=" and province ='"+currentUserRoleCode+"'";break;}
//                case "2":{resultSql +=" DISTINCT (city_name) as name";
//                    whereSql+=" and city ='"+currentUserRoleCode+"'";break;}
//                case "3":{resultSql +=" DISTINCT (town_name) as name";
//                    whereSql+=" and town ='"+currentUserRoleCode+"'";break;}
//                case "4":{resultSql +=" DISTINCT (name) as name";
//                    whereSql+=" and code ='"+currentUserRoleCode+"'";break;}
//            }
//            String sql = "select "+resultSql+" from dm_hospital  where level=2 "+whereSql ;
//            List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
//            sendName = returnList.get(0).get("name")+"";
//
//            Map<String,Object> resultMap = labelService.fetchUserHighestAuthority(sendCode);
//            List<String> roleList = (List<String>)resultMap.get("roleList");
//            List<RoleVo> roleVoLists= new ArrayList<>();
//            for(String one:roleList){
//                RoleVo roleVo = new RoleVo();
//                roleVo.setCode(one);
//                roleVoLists.add(roleVo);
//            }
//            healthEduArticlePatient.setRoleList(roleVoLists);
//            healthEduArticlePatient.setCurrentUserRoleCode(currentUserRoleCode);
//            healthEduArticlePatient.setCurrentUserRoleLevel(currentUserRoleLevel);
//        }else{
//            healthEduArticlePatient.setCurrentUserRoleCode(doctor.getHospital());
//            healthEduArticlePatient.setCurrentUserRoleLevel("4");
//        }
//        healthEduArticlePatient.setSendType(sendType);
//        healthEduArticlePatient.setDoctorCode(sendCode);
//        healthEduArticlePatient.setSendName(sendName);
//        healthEduArticlePatient.setAdminTeamCode(teamId);
//        healthEduArticlePatient.setLeaveWords(leaveWords);
//        if (doctor != null) {
//            healthEduArticlePatient.setDoctorName(doctor.getName());
//            healthEduArticlePatient.setHospital(doctor.getHospital());
//            healthEduArticlePatient.setHospitalName(doctor.getHospitalName());
//            healthEduArticlePatient.setTown(doctor.getTown());
//            healthEduArticlePatient.setTownName(doctor.getTownName());
//            healthEduArticlePatient.setSendLevel(doctor.getLevel() != null ? String.valueOf(doctor.getLevel()) : "");
//            healthEduArticlePatient.setSendPic(doctor.getPhoto());
//            healthEduArticlePatient.setSendSex(doctor.getSex() != null ? String.valueOf(doctor.getSex()) : "");
//        }
//        healthEduArticlePatient.setBatchNo(batchNo);
//        healthEduArticlePatient.setCreateTime(new Date());
//
//        //通过文章id 获取文章详情
//        JSONObject article = thirdJkEduArticleService.getArticalById(articleId,"");
//
//        healthEduArticlePatient.setArticleId(article.get("articleId") + "");
//        healthEduArticlePatient.setAttachedTitle(article.get("articleTitle") + "");
//        healthEduArticlePatient.setAttachedPic(article.get("articleCover") + "");
//        healthEduArticlePatient.setAttachedContent(article.get("articleContent") + "");
//        healthEduArticlePatient.setAttachedMessage(sendMessage);
//        healthEduArticlePatient.setArticleType(article.get("articleType") + "");
//        healthEduArticlePatient.setLevel(article.get("articlelevel") + "");
//        healthEduArticlePatient.setLevel1Type(article.get("firstLevelCategoryId") + "");
//        healthEduArticlePatient.setLevel2Type(article.get("secondLevelCategoryId") + "");
//        healthEduArticlePatient.setType("1");//文章
////        healthEduArticlePatient.setArticleUrl(articleBaseUrl+"JkEduWeb/web/jkEdu/articleDetail.html?behavior=4&articleId="+articleId+"&userId="+);
//        healthEduArticlePatient.setPatients(patientList);
        List<HealthEduArticleES> healthEduArticleESList = new ArrayList<>();
        Doctor doctor = doctorDao.findByCode(sendCode);
@ -551,21 +360,6 @@ public class JMJkEduArticleService extends BaseService {
        String sendName = "";
        List<DoctorRole> roleList = doctorRoleDao.findUserRole(sendCode);
        if(sendType==2){
//            String resultSql ="";
//            String whereSql ="";
//            switch (currentUserRoleLevel){
//                case "1":{resultSql +=" DISTINCT (province_name) as name";
//                    whereSql+=" and province ='"+currentUserRoleCode+"'";break;}
//                case "2":{resultSql +=" DISTINCT (city_name) as name";
//                    whereSql+=" and city ='"+currentUserRoleCode+"'";break;}
//                case "3":{resultSql +=" DISTINCT (town_name) as name";
//                    whereSql+=" and town ='"+currentUserRoleCode+"'";break;}
//                case "4":{resultSql +=" DISTINCT (name) as name";
//                    whereSql+=" and code ='"+currentUserRoleCode+"'";break;}
//            }
//            String sql = "select "+resultSql+" from dm_hospital  where level=2 "+whereSql ;
//            List<Map<String, Object>> returnList = jdbcTemplate.queryForList(sql);
//            sendName = returnList.get(0).get("name")+"";
            //通过当前的登陆角色获取角色名称
            for(DoctorRole ones :roleList){
                if(ones.getCode().equals(currentUserRoleCode)){
@ -654,7 +448,7 @@ public class JMJkEduArticleService extends BaseService {
        e.setPatientCode(null);
        e.setPatientName(null);
        elastricSearchSave.save(e, esIndex, esType);
        thirdJkEduArticleService.saveBehavior(articleId,doctor.getCode(),7,patientSet.size());
        return healthEduArticleESList;
    }
    public JSONObject pushArticleConfirm(String articleId, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode,String currentUserRole, String currentUserRoleLevel) throws Exception {
@ -680,61 +474,12 @@ public class JMJkEduArticleService extends BaseService {
     */
    public void initPatient(Set<String> patientSet, String labelUnit, String labelSex, String labelServe, String labelDisease, String labelHealth,String userCode,String currentUserRole, String currentUserRoleLevel) {
        //全选的时候前端传0,后台要去数据库再查询一次
//        if ("0".equals(labelUnit)) {
//            //查找全部的下属单位
////            String sql = "select Group_concat(code) code  from dm_hospital  where level=2 and town = '350211'";
////            labelUnit = jdbcTemplate.queryForObject(sql, String.class);
//            List<DictModel> dictModels = labelService.getUnitLabels(userCode);
//            labelUnit ="";
//            for(DictModel one:dictModels){
//                labelUnit+=","+one.getCode();
//            }
//
//            labelUnit=labelUnit.substring(1);
//        }
//        if ("0".equals(labelSex)) {
//            //查找全部的性别
//            labelSex = "1,2";
//        }
//        if ("0".equals(labelServe)) {
//            //查找全部的服务类型
//            String sql = "select Group_concat(s.code) from wlyy_sign_dict s where s.year='2017' order by s.sort asc";
//            labelServe = jdbcTemplate.queryForObject(sql, String.class);
//        }
//        if ("0".equals(labelDisease)) {
//            //查找全部的疾病标签
//            String sql = "select Group_concat(s.label_code)  from wlyy_sign_patient_label s where s.label_type=3 and status=1";
//            labelDisease = jdbcTemplate.queryForObject(sql, String.class);
//        }
//        if ("0".equals(labelHealth)) {
//            //查找全部的健康情况
//            String sql = "select Group_concat(s.label_code)  from wlyy_sign_patient_label s where s.label_type=2 and status=1";
//            labelHealth = jdbcTemplate.queryForObject(sql, String.class);
//        }
        String tableSql = " select p.code from wlyy_sign_family w left join dm_hospital h on w.hospital=h.code ";
        String whereSql = " where w.status>0  ";
        //通过登录的角色区域权限 限制所属患者条件
//        Map<String,Object> resultLevel = labelService.fetchUserHighestAuthority(userCode);
//        List<String> list =  (List<String>)resultLevel.get("roleList");
//        Integer level = (Integer)resultLevel.get("level");
//        StringBuilder role = new StringBuilder();
//        for(String one :list){
//            role.append(",'"+one+"'");
//        }
//        String roleSql = !StringUtils.isEmpty(role+"")?role.substring(1):"";
//        if(StringUtils.isEmpty(roleSql)){
//
//            switch (level){
//                case 1:{whereSql+=" and h.province in ("+role+")" ;break;}
//                case 2:{whereSql+=" and h.city in ("+role+")" ;break;}
//                case 3:{whereSql+=" and h.town in ("+role+")" ;break;}
//                case 4:{whereSql+=" and h.code in ("+role+")" ;break;}
//            }
//
//        }
        if(!StringUtils.isEmpty(labelUnit)){
            switch (currentUserRoleLevel){
                case "1":{whereSql+=" and h.city in ("+labelUnit+")" ;break;}
@ -758,31 +503,21 @@ public class JMJkEduArticleService extends BaseService {
        if (!StringUtils.isEmpty(labelHealth) || !StringUtils.isEmpty(labelDisease)) {
            tableSql += " left join wlyy_sign_patient_label_info l on w.patient=l.patient ";
            whereSql += " and l.status=1 ";
    
            if (!StringUtils.isEmpty(labelHealth) && !StringUtils.isEmpty(labelDisease)) {
                whereSql += " and ( (l.label_type = 2 AND l.label in (" + labelHealth + ") ) or (l.label_type = 3 AND l.label in (" + labelDisease + ") ))";
            }else {
                if(!StringUtils.isEmpty(labelHealth)){
                    whereSql += " and (l.label_type = 2 AND l.label in (" + labelHealth + "))";
                }
                
                if(!StringUtils.isEmpty(labelDisease)){
                    whereSql += " and (l.label_type = 3 AND l.label in (" + labelDisease + "))";
                }
            }
        }
//        if (!StringUtils.isEmpty(labelDisease)) {
//            if (!whereSql.endsWith(" and ( ")) {
//                whereSql += " or (l.label_type = 3 AND l.label in (" + labelDisease + "))) ";
//            } else {
//                whereSql += " l.label_type = 3 AND l.label in (" + labelDisease + ")) ";
//            }
//        }
//        if (!StringUtils.isEmpty(labelHealth) || !StringUtils.isEmpty(labelDisease)) {
//            whereSql += ")";
//        }
        
        tableSql += " left join wlyy_patient p on p.code=w.patient AND p.openid IS NOT NULL and p.openid <>''";
        if (!StringUtils.isEmpty(labelSex)) {
            whereSql += " and p.sex in (" + labelSex + ") ";
@ -960,112 +695,10 @@ public class JMJkEduArticleService extends BaseService {
        return result;
    }
//    /**
//     * 医生推送文章初始化被推患者信息
//     * @param patientSet
//     * @param labelType
//     * @param condition
//     * @param groupType
//     * @param teamId
//     * @param doctorCode
//     */
//    public void initPatients(Set<String> patientSet, String labelType, String condition, String groupType,Long teamId,String doctorCode) {
//
//        String adminTeamCodetemp = "";
//        if(teamId!=null){
//            adminTeamCodetemp+=teamId.longValue();
//        }else{
//            List<AdminTeam> teamList = teamService.getDoctorTeams(doctorCode);
//            for(AdminTeam one:teamList){
//                adminTeamCodetemp+=","+one.getId();
//            }
//            adminTeamCodetemp=adminTeamCodetemp.length()>0?adminTeamCodetemp.substring(1):"";
//        }
//
//        String[] cond = {};
//        String[] group = {};
//        if (!StringUtils.isEmpty(condition)) {
//            cond = condition.split(",");
//        }
//        StringBuilder whereSql = new StringBuilder();
//        String tableSql = "";
//        for (String one : cond) {
//            if ("1".equals(one)) {//有绑定设备
//                tableSql = " LEFT JOIN wlyy_patient_device d on d.user=aa.patient and d.device_id is not null ";
//            } else if ("2".equals(one)) {//孕产妇
//                whereSql.append(" and tt LIKE '%41%' ");
//            } else if ("3".equals(one)) {//65岁以上老年人
//                whereSql.append(" and tt LIKE '%13%' ");
//            }
//        }
//
//        if (!StringUtils.isEmpty(groupType)) {
//            group = groupType.split(",");
//        }
//        String sql = "";
//        List<String> groupPatient = null;
//        List<String> resultList = new ArrayList<>();
//        switch (labelType) {
//            case "1": {
//                for (String one : group) {
//                    sql = " SELECT DISTINCT(aa.patient)  FROM " +
//                            " ( SELECT a.patient, GROUP_CONCAT( concat(a.label_type, a.label) ) tt " +
//                            " FROM ( SELECT l.* FROM wlyy_sign_family w, wlyy_sign_patient_label_info l, " +
//                            " wlyy_sign_family_server q WHERE w. STATUS > 0 AND l. STATUS = 1 AND w.admin_team_code in (" +adminTeamCodetemp+")"+
//                            " AND w.patient = l.patient " +//AND LEFT (w.hospital, 6) = '350211' " +
//                            " AND w. CODE = q.sign_code AND q.server_type = 1 ) a " +
//                            " GROUP BY a.patient HAVING 1 = 1  " + whereSql +  " and tt LIKE '%" + labelType + one + "%'  ) aa " + tableSql;
//                    groupPatient = jdbcTemplate.queryForList(sql, String.class);
//                    resultList.addAll(groupPatient);
//                }
//                break;
//            }
//            case "2": {
//                for (String one : group) {
//                    sql = " select DISTINCT(aa.patient) from ( " +
//                            " SELECT a.patient, GROUP_CONCAT( concat(a.label_type, a.label) ) tt " +
//                            " FROM ( SELECT l.* FROM wlyy_sign_family w, wlyy_sign_patient_label_info l " +
//                            " WHERE w. STATUS > 0 and l.status=1 AND w.admin_team_code in ("+adminTeamCodetemp+") AND w.patient = l.patient ) a " +// AND LEFT (w.hospital, 6) = '350211' ) a " +
//                            " GROUP BY a.patient HAVING 1=1 " + whereSql + "  and tt LIKE '%" + labelType + one + "%' ) aa " + tableSql;
//                    groupPatient = jdbcTemplate.queryForList(sql, String.class);
//                    resultList.addAll(groupPatient);
////                }
//                }
//                break;
//            }
//            case "3": {
//                for (String one : group) {
//                    sql = " select DISTINCT(aa.patient)  from ( " +
//                            " SELECT a.patient, GROUP_CONCAT( concat(a.label_type, a.label) ) tt " +
//                            " FROM ( SELECT l.* FROM wlyy_sign_family w, wlyy_sign_patient_label_info l " +
//                            " WHERE w. STATUS > 0 and l.status=1 AND w.admin_team_code in ("+adminTeamCodetemp+") AND w.patient = l.patient ) a " +// AND LEFT (w.hospital, 6) = '350211' ) a " +
//                            " GROUP BY a.patient HAVING 1=1 " + whereSql + " and tt LIKE '%" + labelType + one + "%') aa " + tableSql;
//                    groupPatient = jdbcTemplate.queryForList(sql, String.class);
//                    resultList.addAll(groupPatient);
////                }
//                }
//                break;
//            }
//            case "4": {
//                for (String one : group) {
//                    sql = " select DISTINCT(aa.patient) from ( " +
//                            " SELECT a.patient, GROUP_CONCAT( concat(a.label_type, a.label) ) tt " +
//                            " FROM ( SELECT l.* FROM wlyy_sign_family w, wlyy_sign_patient_label_info l " +
//                            " WHERE w. STATUS > 0 and l.status=1 AND w.admin_team_code in ("+adminTeamCodetemp+") AND w.patient = l.patient ) a " +// AND LEFT (w.hospital, 6) = '350211' ) a " +
//                            " GROUP BY a.patient HAVING 1=1 " + whereSql.toString() + " and tt LIKE '%" + labelType + one + "%') aa " + tableSql;
//                    groupPatient = jdbcTemplate.queryForList(sql, String.class);
//                    resultList.addAll(groupPatient);
////                }
//                }
//                break;
//            }
//        }
//        patientSet.addAll(resultList);
//    }
    
    
    public void readAllArticle(String patient)throws Exception{
    
//        JestClient jestClient = null;
//
//        try {
@ -1107,16 +740,16 @@ public class JMJkEduArticleService extends BaseService {
//        for (HealthEduArticlePatient healthEduArticlePatient: esList) {
//            healthEduArticlePatient.setIsread("1");
//        }
        
    }
    
    /**
     * 一键修改居民推送文章的文章为已读
     * @param patient
     */
    public void readAllArticleNew(String patient,String firstLevelCategoryId){
        JestClient jestClient = null;
    
        try {
            jestClient = elasticFactory.getJestClient();
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -1124,7 +757,8 @@ public class JMJkEduArticleService extends BaseService {
                    new BoolQueryBuilder()
                            .must(QueryBuilders.matchQuery("patientCode", patient))
                            .must(QueryBuilders.matchQuery("firstLevelCategoryId", firstLevelCategoryId))
            );
                            .must(QueryBuilders.matchQuery("isRead", "0"))
            ).size(10000);
            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType).build();
            SearchResult result = jestClient.execute(search);
            List<HealthEduArticleES> dataList = result.getSourceAsObjectList(HealthEduArticleES.class);
@ -1151,7 +785,7 @@ public class JMJkEduArticleService extends BaseService {
            }
        }
    }
    
    /**
     * 居民单条文章增加已读状态
     * @param patient
@ -1159,7 +793,7 @@ public class JMJkEduArticleService extends BaseService {
     */
    public void readPatientArticle(String patient,String articleId){
        JestClient jestClient = null;
        
        try {
            jestClient = elasticFactory.getJestClient();
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -1194,14 +828,14 @@ public class JMJkEduArticleService extends BaseService {
            }
        }
    }
    
    public JSONArray pushArticleLogs(int page, int pagesize, String patientCode,String level1Type) throws Exception {
        page = (page - 1) * pagesize;
        String sql = "SELECT * FROM " + esType + "  where patientCode= '" + patientCode + "' and userType = 1";
        
        if(!StringUtils.isEmpty(level1Type)){
            sql= sql + " and firstLevelCategoryId = '"+level1Type+"' ";
        }
@ -1209,7 +843,7 @@ public class JMJkEduArticleService extends BaseService {
        if(pagesize !=0){
            sql= sql+  " limit " + page + "," + pagesize;
        }
        
        List<HealthEduArticleES> esList = elasticsearchUtil.excute(sql, HealthEduArticleES.class, esIndex, esType);
        HealthEduArticlePatientModel heapm = null;
        JSONObject article = null;

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java

@ -72,7 +72,7 @@ public class ThirdJkEduArticleService extends BaseService {
    private DoctorRoleDao doctorRoleDao;
    @Autowired
    private HospitalDao hospitalDao;
    
    //    private String baseUrl = "http://service.yihu.com:8085/WsPlatform/rest";
//    private String baseUrl = "http://172.17.110.230:83/WsPlatform/rest";
//    private String baseUrl = articleBaseUrl+"/WsPlatform/rest";

+ 21 - 8
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java

@ -1,5 +1,7 @@
package com.yihu.wlyy.web.data;
import com.yihu.wlyy.rest.demo.TestSwagger;
import com.yihu.wlyy.rest.model.common.SimpleResult;
import com.yihu.wlyy.service.app.consult.ConsultTeamService;
import com.yihu.wlyy.service.app.sign.FamilyContractService;
import com.yihu.wlyy.web.BaseController;
@ -150,7 +152,7 @@ public class DataHandlingController extends BaseController {
        } catch (Exception e) {
            e.printStackTrace();
        }
        return write(200, "数据转移成功!","data",flag);
        return write(200, "数据转移成功!", "data", flag);
    }
    @RequestMapping(value = "/updateEsArticlePatent", method = RequestMethod.GET)
@ -178,34 +180,45 @@ public class DataHandlingController extends BaseController {
            e.printStackTrace();
        }
        return write(200, "数据更新成功!","data",flag);
        return write(200, "数据更新成功!", "data", flag);
    }
    @RequestMapping(value = "/deleteEsOldArticlePateint",method = RequestMethod.GET)
    @RequestMapping(value = "/deleteEsOldArticlePateint", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("删除Es里转移过去的文章发送记录")
    public String deleteEsOldArticlePatient(){
    public String deleteEsOldArticlePatient() {
        Map<String, Object> flag = null;
        try {
            flag = eduArticleService.deleteEsOldArticlePatient();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return write(200, "数据更新成功!","data",flag);
        return write(200, "数据更新成功!", "data", flag);
    }
    @RequestMapping(value = "/addBatchNo",method = RequestMethod.GET)
    @RequestMapping(value = "/addBatchNo", method = RequestMethod.GET)
    @ResponseBody
    @Deprecated
    @ApiOperation("给空的batchNo赋值")
    public String addBatchNo(String doctor){
    public String addBatchNo(String doctor) {
        Map<String, Object> flag = null;
        try {
            flag = eduArticleService.addBatchNo(doctor);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return write(200, "数据更新成功!","data",flag);
        return write(200, "数据更新成功!", "data", flag);
    }
    @RequestMapping(value = "/testSwagger", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("测试swagger")
    public SimpleResult<TestSwagger> testSwagger(
            @ApiParam(name = "username", value = "账号", required = true)
            @RequestParam(value = "username") String username) {
        return new SimpleResult<>(new TestSwagger());
    }
}

+ 39 - 41
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java

@ -156,7 +156,7 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                        articleids.add(pushresponse.getJSONObject(i).getString("articleId"));
                    }
                }
                StringBuffer sql3 = null;
                JSONArray datas = response.getJSONArray("aaData");
                if(datas.size() > 0 && !articleids.isEmpty()){
                    for (int i = 0; i < datas.size(); i++) {
@ -166,10 +166,8 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
                        }else{
                            datas.getJSONObject(i).put("ispush","0");
                        }
//                        sql3 = new StringBuffer();
//                        sql3.append("SELECT COUNT(*) as num FROM "+esType+" WHERE  userType=2 AND articleId='"+dataarticleid+"'");
//                        Long num = elasticsearchUtil.excuteForLong(sql3.toString(), esType, esIndex);
//                        datas.getJSONObject(i).put("ispush","0");
//                        1.4.1版本正式环境目前的推送数量是以commentnumber字段获取,等1.4.2版本的时候调整为pushnumber
//                        datas.getJSONObject(i).put("commentnumber",datas.getJSONObject(i).getString("pushnumber"));
                    }
                    response.put("aaData",datas);
                }
@ -185,23 +183,23 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    @RequestMapping(value = "authenArticlePCList", method = RequestMethod.GET)
    @ApiOperation("查询pc端文章认证列表")
    public  String authenArticlePCList(@ApiParam(name = "firstLevelCategoryId", value = "文章一级分类")
                                      @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                      @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                      @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                      @ApiParam(name = "insertTimeStart", value = "新增文章开始时间")
                                      @RequestParam(value = "insertTimeStart", required = false) String insertTimeStart,
                                      @ApiParam(name = "insertTimeEnd", value = "新增文章结束时间")
                                      @RequestParam(value = "insertTimeEnd", required = false) String insertTimeEnd,
                                      @ApiParam(name = "articleTitle", value = "文章标题关键字")
                                      @RequestParam(value = "articleTitle", required = false) String articleTitle,
                                      @ApiParam(name = "isAuthentication", value = "是否认证")
                                      @RequestParam(value = "isAuthentication", required = false) String isAuthentication,
                                      @ApiParam(name = "iDisplayStart", value = "当前页")
                                      @RequestParam(value = "iDisplayStart", required = true) Integer page,
                                      @ApiParam(name = "iDisplayLength", value = "是否过滤我的文章")
                                      @RequestParam(value = "iDisplayLength", required = true) Integer pageSize,
                                      @ApiParam(name = "sEcho", value = "插件自带")
                                      @RequestParam(value = "sEcho", required = false) Integer sEcho){
                                       @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                       @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                       @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                       @ApiParam(name = "insertTimeStart", value = "新增文章开始时间")
                                       @RequestParam(value = "insertTimeStart", required = false) String insertTimeStart,
                                       @ApiParam(name = "insertTimeEnd", value = "新增文章结束时间")
                                       @RequestParam(value = "insertTimeEnd", required = false) String insertTimeEnd,
                                       @ApiParam(name = "articleTitle", value = "文章标题关键字")
                                       @RequestParam(value = "articleTitle", required = false) String articleTitle,
                                       @ApiParam(name = "isAuthentication", value = "是否认证")
                                       @RequestParam(value = "isAuthentication", required = false) String isAuthentication,
                                       @ApiParam(name = "iDisplayStart", value = "当前页")
                                       @RequestParam(value = "iDisplayStart", required = true) Integer page,
                                       @ApiParam(name = "iDisplayLength", value = "是否过滤我的文章")
                                       @RequestParam(value = "iDisplayLength", required = true) Integer pageSize,
                                       @ApiParam(name = "sEcho", value = "插件自带")
                                       @RequestParam(value = "sEcho", required = false) Integer sEcho){
        try {
@ -220,14 +218,14 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    public  String saveOrUpdateArticleQR(
//                                        @ApiParam(name = "currentRoleLevel", value = "当前登录角色的级别")
//                                         @RequestParam(value = "currentRoleLevel", required = true) String currentRoleLevel,
                                         @ApiParam(name = "identification", value = "认证标识文字")
                                         @RequestParam(value = "identification", required = false) String identification,
                                         @ApiParam(name = "position", value = "位置")
                                         @RequestParam(value = "position", required = false) Integer position,
                                         @ApiParam(name = "imgUrl", value = "二维码图片地址")
                                         @RequestParam(value = "imgUrl", required = false) String imgUrl,
                                         @ApiParam(name = "id", value = "认证标识id")
                                         @RequestParam(value = "id", required = false) Integer id){
            @ApiParam(name = "identification", value = "认证标识文字")
            @RequestParam(value = "identification", required = false) String identification,
            @ApiParam(name = "position", value = "位置")
            @RequestParam(value = "position", required = false) Integer position,
            @ApiParam(name = "imgUrl", value = "二维码图片地址")
            @RequestParam(value = "imgUrl", required = false) String imgUrl,
            @ApiParam(name = "id", value = "认证标识id")
            @RequestParam(value = "id", required = false) Integer id){
        try{
            jmJkEduArticleService.saveOrUpdateArticleQR(getCurrentRoleLevel(),getCurrentRoleCode(),position,imgUrl,getUID(),id,identification);
@ -241,17 +239,17 @@ public class DoctorJMJkEduArticlePCController extends BaseController {
    @RequestMapping(value = "authenticationArticle", method = RequestMethod.POST)
    @ApiOperation("文章认证")
    public  String authenticationArticle(@ApiParam(name = "articleId", value = "文章id,多个文章‘,’隔开")
                                          @RequestParam(value = "articleId", required = true) String articleId,
                                          @ApiParam(name = "isAuthentication", value = "认证,0取消认证,1认证")
                                          @RequestParam(value = "isAuthentication", required = true) String isAuthentication,
                                          @ApiParam(name = "firstLevelCategoryId", value = "文章一级分类")
                                          @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                          @ApiParam(name = "firstLevelCategoryName", value = "文章一级分类名称")
                                          @RequestParam(value = "firstLevelCategoryName", required = false) String firstLevelCategoryName,
                                          @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                          @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                          @ApiParam(name = "secondLevelCategoryName", value = "文章二级分类名称")
                                          @RequestParam(value = "secondLevelCategoryName", required = false) String secondLevelCategoryName){
                                         @RequestParam(value = "articleId", required = true) String articleId,
                                         @ApiParam(name = "isAuthentication", value = "认证,0取消认证,1认证")
                                         @RequestParam(value = "isAuthentication", required = true) String isAuthentication,
                                         @ApiParam(name = "firstLevelCategoryId", value = "文章一级分类")
                                         @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                         @ApiParam(name = "firstLevelCategoryName", value = "文章一级分类名称")
                                         @RequestParam(value = "firstLevelCategoryName", required = false) String firstLevelCategoryName,
                                         @ApiParam(name = "secondLevelCategoryId", value = "文章二级分类")
                                         @RequestParam(value = "secondLevelCategoryId", required = false) String secondLevelCategoryId,
                                         @ApiParam(name = "secondLevelCategoryName", value = "文章二级分类名称")
                                         @RequestParam(value = "secondLevelCategoryName", required = false) String secondLevelCategoryName){
        try{
            jmJkEduArticleService.authenticationArticle(articleId,isAuthentication,firstLevelCategoryId,firstLevelCategoryName,secondLevelCategoryId,secondLevelCategoryName);
            return success("认证成功!");

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

@ -189,7 +189,7 @@ public class SignPatientLabelInfoController extends BaseController {
                                        @RequestParam(required = false) boolean isFollowWeChat,
                                        @RequestParam(required = false) String trackFlag,
                                        @RequestParam(required = false) String startDate,
                                        @RequestParam(required = false) String enddate) {
                                        @RequestParam(required = false) String endDate) {
        try {
            if (StringUtils.isEmpty(labelCode)) {
                return error(-1, "标签cdoe不能为空");
@ -210,7 +210,7 @@ public class SignPatientLabelInfoController extends BaseController {
                return write(200, "查询成功", "data", jsonObject);
            }
            JSONArray result = labelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition,isFollowWeChat,trackFlag,startDate,enddate);
            JSONArray result = labelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition,isFollowWeChat,trackFlag,startDate,endDate);
//            JSONArray result = labelInfoService.getPatientByLabel("xy201703150222", labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition,isFollowWeChat);
            return write(200, "查询成功", "data", result);

+ 5 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/scheme/PatientSchemeController.java

@ -121,7 +121,11 @@ public class PatientSchemeController extends BaseController {
    @ApiOperation("设置居民监测列表")
    public String setPatientDefaultScheme(@ApiParam(name="type", value="1.糖尿病,2.高血压") @RequestParam(value = "type",required = true)String type){
        try {
            return write(200, "设置成功", "data",doctorSchemeService.setPatientDefaultScheme(getUID(),type));
            String rs = doctorSchemeService.setPatientDefaultScheme(getUID(),type);
            if("-1".equals(rs)){
                return error(-1, "居民监测列表已经存在");
            }
            return write(200, "设置成功", "data",rs);
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果

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

@ -2121,7 +2121,7 @@ public class EsStatisticsController extends BaseController {
                lowLevel = elasticsearchUtil.changeLevel(Integer.parseInt(lowLevel)) + "";
            }
            JSONObject result = new JSONObject();
            result.put("",statisticsESService.getArticleLowlevelTotal(endDate, area, level, sort, lowLevel, level2_type, year));
            result.put("index_83_84",statisticsESService.getArticleLowlevelTotal(endDate, area, level, sort, lowLevel, level2_type, year));
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
            e.printStackTrace();

+ 25 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/HealthEduArticlePatientModel.java

@ -41,6 +41,8 @@ public class HealthEduArticlePatientModel {
    private Integer commentNumber=0;//文章评论数
    @ApiModelProperty(value = "文章点赞数", required = false, access = "response")
    private Integer pointNumber=0;//文章点赞数
    @ApiModelProperty(value = "文章发送数", required = false, access = "response")
    private Integer pushNumber=0;//文章发送数
    @ApiModelProperty(value = "文章阅读数", required = false, access = "response")
    private Long readNumber=0L;//文章阅读数
    @ApiModelProperty(value = "封面图", required = false, access = "response")
@ -55,7 +57,7 @@ public class HealthEduArticlePatientModel {
    private Integer collectionNumber;//收藏数
    @ApiModelProperty(value = "文章来源", required = false, access = "response")
    private String articleSource;//文章来源
    
    private String computeTime;//时间
    private String photo;//医生头像
    private String operatorName;//文章作者
@ -204,43 +206,43 @@ public class HealthEduArticlePatientModel {
    public void setOperatorName(String operatorName) {
        this.operatorName = operatorName;
    }
    
    public Integer getSendType() {
        return sendType;
    }
    
    public void setSendType(Integer sendType) {
        this.sendType = sendType;
    }
    
    public String getIsread() {
        return isread;
    }
    
    public void setIsread(String isread) {
        this.isread = isread;
    }
    
    public String getLeaveWords() {
        return leaveWords;
    }
    
    public void setLeaveWords(String leaveWords) {
        this.leaveWords = leaveWords;
    }
    
    public String getLevel1TypeName() {
        return level1TypeName;
    }
    
    public void setLevel1TypeName(String level1TypeName) {
        this.level1TypeName = level1TypeName;
    }
    
    public String getLevel2TypeName() {
        return level2TypeName;
    }
    
    public void setLevel2TypeName(String level2TypeName) {
        this.level2TypeName = level2TypeName;
    }
@ -252,11 +254,11 @@ public class HealthEduArticlePatientModel {
    public void setCollectionNumber(Integer collectionNumber) {
        this.collectionNumber = collectionNumber;
    }
    
    public String getArticleSource() {
        return articleSource;
    }
    
    public void setArticleSource(String articleSource) {
        this.articleSource = articleSource;
    }
@ -268,11 +270,19 @@ public class HealthEduArticlePatientModel {
    public void setReadNumber(Long readNumber) {
        this.readNumber = readNumber;
    }
    
    public Integer getPushNumber() {
        return pushNumber;
    }
    public void setPushNumber(Integer pushNumber) {
        this.pushNumber = pushNumber;
    }
    public String getCzrq() {
        return czrq;
    }
    
    public void setCzrq(String czrq) {
        this.czrq = czrq;
    }

+ 5 - 5
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java

@ -85,7 +85,7 @@ public class ThirdJkEduArticleController extends BaseController {
        try {
            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getRepUID(),userType,myArticle);
//            com.alibaba.fastjson.JSONArray response = thirdJkEduArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"812f75071f434fde9a1fb64c6213a897",userType,myArticle);
    
            //判断文章列表是否有推送过该居民
            if(org.apache.commons.lang3.StringUtils.isNotBlank(patient)){
                com.alibaba.fastjson.JSONArray pushresponse = jmJkEduArticleService.pushArticleLogs(0,0,patient,"");
@ -95,7 +95,7 @@ public class ThirdJkEduArticleController extends BaseController {
                        articleids.add(pushresponse.getJSONObject(i).getString("articleId"));
                    }
                }
        
                if(response.size() > 0 && !articleids.isEmpty()){
                    for (int i = 0; i < response.size(); i++) {
                        String dataarticleid = response.getJSONObject(i).getString("articleId");
@ -122,11 +122,11 @@ public class ThirdJkEduArticleController extends BaseController {
                                 @RequestParam(value = "userType", required = false) String userType){
        try {
            com.alibaba.fastjson.JSONObject response = thirdJkEduArticleService.getArticalById(articleId,getUID());
            
            if("2".equals(userType)){
                jmJkEduArticleService.readPatientArticle(getRepUID(),articleId);
            }
            
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
@ -312,7 +312,7 @@ public class ThirdJkEduArticleController extends BaseController {
            return error(-1,"查询失败!");
        }
    }
    
    @RequestMapping(value = "getCategoryByName",method = RequestMethod.GET)
    @ApiOperation("根据一级类别名称获取二级分类下得所有分类")
    public String getCategoryList(@ApiParam(name = "name", value = "类别名称")

+ 13 - 3
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java

@ -1,5 +1,7 @@
package com.yihu.wlyy.wechat.process;
import com.yihu.wlyy.entity.dict.SystemDict;
import com.yihu.wlyy.repository.dict.SystemDictDao;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.wechat.util.WeiXinMessageReplyUtils;
@ -37,6 +39,8 @@ public class WeiXinEventProcess {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private SystemDictDao systemDictDao;
    /**
     * 微信推送事件处理
@ -408,12 +412,13 @@ public class WeiXinEventProcess {
                if(cout>0){
                    Map<String, String> articleConsult = new HashMap<>();
                    // 图文URL
                    String urlConsult = systemConf.getProperty("patient_wifi_url");
                    String urlConsult = getSystemWifiUrl();
                    logger.info("hslq_Wifi_total_URL:"+urlConsult);
                    // 图文消息图片URL
                    String picUrlConsult = systemConf.getProperty("patient_wifi_pic_url");
                    // URL设置服务器URL、AppId
                    urlConsult = urlConsult.replace("{server}", wechat_base_url)
                            .replace("{appId}", appId);
//                    urlConsult = urlConsult.replace("{server}", wechat_base_url)
//                            .replace("{appId}", appId);
                    //图片地址
                    picUrlConsult = picUrlConsult.replace("{server}", serverUrl);
@ -430,6 +435,11 @@ public class WeiXinEventProcess {
        }
    }
    public String getSystemWifiUrl(){
        List<SystemDict> systemDicts =  systemDictDao.findByDictName("HSLQ_WIFI");
        return systemDicts.get(0).getCode();
    }
    /**
     * 设置微信公共的图文消息
     *

+ 7 - 0
pom.xml

@ -61,6 +61,13 @@
        <version.mysql>5.1.38</version.mysql>
        <version.activemq>5.15.0</version.activemq>
        <version.common>1.0.0</version.common>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <asciidoctor.maven.plugin.version>1.5.5</asciidoctor.maven.plugin.version>
        <asciidoctorj.version>1.5.5</asciidoctorj.version>
        <maven.build.timestamp.format>yyyy-MM-dd HH:mm:ss</maven.build.timestamp.format>
    </properties>