Explorar o código

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

zd_123 %!s(int64=7) %!d(string=hai) anos
pai
achega
6a63260932
Modificáronse 46 ficheiros con 1855 adicións e 646 borrados
  1. 1 0
      common-lib/pom.xml
  2. 73 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/imm/ChildFamilyImmune.java
  3. 192 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/imm/ChildInfo.java
  4. 25 0
      common/common-rest-model/pom.xml
  5. 33 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/demo/TestSwagger.java
  6. 27 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/ListResult.java
  7. 29 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/PageResult.java
  8. 25 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/SimpleResult.java
  9. 40 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/BasePagingResponse.java
  10. 5 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/BaseResponse.java
  11. 38 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/ErrorResponse.java
  12. 28 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/FieldValidResponse.java
  13. 22 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/KeyValueResponse.java
  14. 27 0
      common/common-rest-model/src/main/java/com.yihu.wlyy/rest/model/common/base/KeyValueVo.java
  15. BIN=BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ArticleApiTest.class
  16. BIN=BIN
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/ArticleDao.class
  17. 12 12
      edu-article/JkEdu/src/com/yihu/jk/api/ArticleApiTest.java
  18. 14 77
      edu-article/JkEdu/src/com/yihu/jk/dao/ArticleDao.java
  19. 13 3
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  20. 1 1
      patient-co/patient-co-wlyy-job/src/main/resources/application-test.yml
  21. BIN=BIN
      patient-co/patient-co-wlyy/doc/技术文档/swagger/swagger文档生成.docx
  22. 58 0
      patient-co/patient-co-wlyy/pom.xml
  23. 45 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  24. 19 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildFamilyImmuneDao.java
  25. 24 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildInfoDao.java
  26. 6 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/scheme/PatientSchemeListDao.java
  27. 13 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  28. 31 16
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java
  29. 84 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java
  30. 84 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildInfoService.java
  31. 40 406
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  32. 505 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java
  33. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/jkEduArticle/ThirdJkEduArticleService.java
  34. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/util/DateUtil.java
  35. 21 8
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/data/DataHandlingController.java
  36. 39 41
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/jimeiJkEduPC/DoctorJMJkEduArticlePCController.java
  37. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java
  38. 127 13
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java
  39. 70 21
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java
  40. 5 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/scheme/PatientSchemeController.java
  41. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  42. 25 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/HealthEduArticlePatientModel.java
  43. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkEduArticle/ThirdJkEduArticleController.java
  44. 13 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/wechat/process/WeiXinEventProcess.java
  45. 13 17
      patient-co/patient-co-wlyy/src/main/resources/logback.xml
  46. 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>

+ 73 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/imm/ChildFamilyImmune.java

@ -0,0 +1,73 @@
package com.yihu.wlyy.entity.imm;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 新生儿家人免疫关系表
 * @author huangwenjie
 * @date 2018/1/16 19:20
 */
@Entity
@Table(name = "wlyy_child_family_immune")
public class ChildFamilyImmune  extends IdEntity {
	private String code;
	private String childCode;               //新生儿CODE
	private String familyCode;              //家人CODE
	private Integer relation;               //1父亲 2母亲 3老公 4老婆 5儿子 6女儿 7其他
	private Integer del;                    //0可用,1删除
	private Date create_time;               //创建时间
	
	public String getCode() {
		return code;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getChildCode() {
		return childCode;
	}
	
	public void setChildCode(String childCode) {
		this.childCode = childCode;
	}
	
	public String getFamilyCode() {
		return familyCode;
	}
	
	public void setFamilyCode(String familyCode) {
		this.familyCode = familyCode;
	}
	
	public Integer getDel() {
		return del;
	}
	
	public void setDel(Integer del) {
		this.del = del;
	}
	
	public Date getCreate_time() {
		return create_time;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}
	
	public Integer getRelation() {
		return relation;
	}
	
	public void setRelation(Integer relation) {
		this.relation = relation;
	}
}

+ 192 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/imm/ChildInfo.java

@ -0,0 +1,192 @@
package com.yihu.wlyy.entity.imm;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 免疫接种-新生儿信息表
 * @author huangwenjie
 * @date 2018/1/16 19:06
 */
@Entity
@Table(name = "wlyy_child_info")
public class ChildInfo extends IdEntity {
	
	private String code;
	private String name;                    //新生儿姓名
	private String idcard;                  //新生儿身份证
	private String ssc;                     //新生儿社保卡
	private String photo;                   //新生儿照片
	private String barcode;                 //新生儿免疫接种条码
	private String sex;                     //新生儿性别 男1.0 女2.0
	private String birthday;                //出生日期
	private String weight;                  //出生体重
	private String height;                  //出生身长
	private String deliverOrgname;          //助产医院
	private String deliverOrgcode;          //助产医院CODE
	private String deliverJworgcode;        //助产医院基卫CODE
	
	private String deliverPerson;           //接生人
	private String motherSsc;               //母亲社保卡
	private String motherName;              //母亲姓名
	private String motherIdcard;            //母亲身份证号
	private Date create_time;               //创建时间
	private Integer del;                    //0可用,1已删除
	
	public String getCode() {
		return code;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	public String getIdcard() {
		return idcard;
	}
	
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	
	public String getSsc() {
		return ssc;
	}
	
	public void setSsc(String ssc) {
		this.ssc = ssc;
	}
	
	public String getPhoto() {
		return photo;
	}
	
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	
	public String getBarcode() {
		return barcode;
	}
	
	public void setBarcode(String barcode) {
		this.barcode = barcode;
	}
	
	public String getSex() {
		return sex;
	}
	
	public void setSex(String sex) {
		this.sex = sex;
	}
	
	public String getBirthday() {
		return birthday;
	}
	
	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}
	
	public String getWeight() {
		return weight;
	}
	
	public void setWeight(String weight) {
		this.weight = weight;
	}
	
	public String getHeight() {
		return height;
	}
	
	public void setHeight(String height) {
		this.height = height;
	}
	
	public String getDeliverOrgname() {
		return deliverOrgname;
	}
	
	public void setDeliverOrgname(String deliverOrgname) {
		this.deliverOrgname = deliverOrgname;
	}
	
	public String getDeliverPerson() {
		return deliverPerson;
	}
	
	public void setDeliverPerson(String deliverPerson) {
		this.deliverPerson = deliverPerson;
	}
	
	public String getMotherSsc() {
		return motherSsc;
	}
	
	public void setMotherSsc(String motherSsc) {
		this.motherSsc = motherSsc;
	}
	
	public String getMotherName() {
		return motherName;
	}
	
	public void setMotherName(String motherName) {
		this.motherName = motherName;
	}
	
	public String getMotherIdcard() {
		return motherIdcard;
	}
	
	public void setMotherIdcard(String motherIdcard) {
		this.motherIdcard = motherIdcard;
	}
	
	public Date getCreate_time() {
		return create_time;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public void setCreate_time(Date create_time) {
		this.create_time = create_time;
	}
	
	public Integer getDel() {
		return del;
	}
	
	public void setDel(Integer del) {
		this.del = del;
	}
	
	public String getDeliverOrgcode() {
		return deliverOrgcode;
	}
	
	public void setDeliverOrgcode(String deliverOrgcode) {
		this.deliverOrgcode = deliverOrgcode;
	}
	
	public String getDeliverJworgcode() {
		return deliverJworgcode;
	}
	
	public void setDeliverJworgcode(String deliverJworgcode) {
		this.deliverJworgcode = deliverJworgcode;
	}
}

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

BIN=BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/api/ArticleApiTest.class


BIN=BIN
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/ArticleDao.class


+ 12 - 12
edu-article/JkEdu/src/com/yihu/jk/api/ArticleApiTest.java

@ -34,7 +34,7 @@ public class ArticleApiTest {
		// System.out.println(api.getCollectionArticalList(im));
		// System.out.println(api.getArticalById(im));
		saveBehavior();
		queryArticlePcList();
//		System.out.printf("350200".substring(0,3));
	}
@ -56,11 +56,10 @@ public class ArticleApiTest {
		ArticleApi api = new ArticleApi();
		InterfaceMessage im = new InterfaceMessage();
		JSONObject obj = new JSONObject();
		obj.put("firstLevelCategoryId","43");
//		obj.put("firstLevelCategoryId","43");
//		obj.put("articleId","0");
//		obj.put("isAuthentication","1");
//		obj.put("secondLevelCategoryId","74889da6-955e-4454-870f-4da37b466264");
//        obj.put("firstLevelCategoryName","健康文章");
//        obj.put("secondLevelCategoryName","孕检知识");
@ -69,22 +68,23 @@ public class ArticleApiTest {
//		obj.put("articlelevel","1");
//		obj.put("articleTitle","我是");
//		obj.put("userCode","0de7295862dd11e69faffa163e8aee56");
		obj.put("userCode","37745c2686f211e6b394fa163e424525");//ylp201703150222
		obj.put("isAuthentication","1");
		obj.put("currentUserRole","3502110100");
		obj.put("currentUserRoleLevel",4);//
		obj.put("page","1");
		obj.put("pageSize","10");
		obj.put("sEcho","1");
		obj.put("isMyArticle",false);
		obj.put("roleType",1);
		obj.put("currentUserRole","3502110400");
		obj.put("userCode","b7f68412638e11e69616fa163e424525");//ylp201703150222
		//obj.put("roleType",1);
		obj.put("isMyArticle",true);
		obj.put("page","0");
		obj.put("pageSize","3");
		obj.put("currentUserRoleLevel",4);//
		//obj.put("sEcho","1");
//		obj.put("articleTitle","健管师");
		im.setParam(obj.toString());
		initDB();
		try{
//			api.authenticationArticle(im);
			System.out.println(api.queryArticleAPPList(im));//initArticleStatistic
			System.out.println(api.queryArticlePcList(im));//initArticleStatistic
//W			api.initArticleStatistic();
		}catch(Exception e){
			e.printStackTrace();

+ 14 - 77
edu-article/JkEdu/src/com/yihu/jk/dao/ArticleDao.java

@ -552,16 +552,11 @@ public class ArticleDao {
		StringBuffer param2 = new StringBuffer();
		StringBuffer pageParam = new StringBuffer();
		StringBuffer param3 = new StringBuffer();
//		if (StringUtil.isNotEmpty(vo.getOperatorRoleLevel())) {
//			param.append(" and OperatorRoleLevel < ? ");
//			sql.addParamValue(vo.getOperatorRoleLevel());
//		}
		if (StringUtil.isNotEmpty(vo.getOperatorId())) {
			param.append(" and OperatorId ='"+vo.getOperatorId()+"' ");
		}
		if(StringUtil.isNotEmpty(vo.getOperatorRoleLevel())){
			int roleLevel = Integer.valueOf(vo.getOperatorRoleLevel())-1;
			String temp = "";
@ -569,40 +564,29 @@ public class ArticleDao {
				switch(i){
					case 1:{
						temp+=" or (UserScope = 1 and OperatorRoleCode like '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,4)):vo.getOperatorRoleCode())+"%')";
//						temp+=" or (UserScope = 1 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,6)):vo.getOperatorRoleCode())+"')";
//						temp+=" or (UserScope = 1 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode()):vo.getOperatorRoleCode())+"')";
						break;}
					case 2:{
						temp+=" or (UserScope = 2 and OperatorRoleCode like '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,6)):vo.getOperatorRoleCode())+"%')";
//						temp+=" or (UserScope = 2 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode()):vo.getOperatorRoleCode())+"')";
						break;}
					case 3:{temp+=" or (UserScope = 3 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode()):vo.getOperatorRoleCode())+"')";break;}
				}
			}
			param3.append(temp.substring(3));
//			if(!StringUtils.isEmpty(temp)){
//				param3.append(temp.substring(3));
//				param3.append("  or (UserScope = ? and OperatorRoleCode =?) ");
//			}else{
//				param3.append("  (UserScope = ? and OperatorRoleCode =?) ");
//			}
//			sql.addParamValue(Integer.valueOf(vo.getOperatorRoleLevel())-1);
//			sql.addParamValue(vo.getOperatorRoleCode());
		}
		param3.append(" or  ( OperatorId='"+userCode+"' and UserScope=4 "+(vo.getRoleType()!=null?" and RoleType = "+vo.getRoleType().intValue():"")+" and OperatorRoleCode = '"+vo.getOperatorRoleCode()+"')");
		if("1".equals(vo.getOperatorRoleLevel())){//省
//			param.append(" and OperatorRoleCode like '"+vo.getOperatorRoleCode().substring(0,3)+"%' ");
		}else if("2".equals(vo.getOperatorRoleLevel())){//市
			param3.append(" or (OperatorRoleLevel= 1 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000 "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 1 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000"):vo.getOperatorRoleCode())+"') ");
		}else if("3".equals(vo.getOperatorRoleLevel())){//区
			param3.append(" or (OperatorRoleLevel= 1 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000 "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 2 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,4)+"00 "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 1 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000"):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 2 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,4)+"00"):vo.getOperatorRoleCode())+"') ");
		}else if("4".equals(vo.getOperatorRoleLevel())){//社区、机构
			param3.append(" or (OperatorRoleLevel= 1 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000 "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 2 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,4)+"00 "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 3 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,6)+" "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 1 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000"):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 2 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,4)+"00"):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 3 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,6)+""):vo.getOperatorRoleCode())+"') ");
		}
		param3.append(" or (OperatorRoleLevel= "+vo.getOperatorRoleLevel()+" and OperatorRoleCode = '"+vo.getOperatorRoleCode()+"' ) ");
		param3.append(" or (OperatorRoleLevel= "+vo.getOperatorRoleLevel()+" and UserScope != 4 and OperatorRoleCode = '"+vo.getOperatorRoleCode()+"' ) ");
		param.append("and ("+param3.toString()+")");
		if(isMyArticle&&vo.getRoleType()!=null) {
@ -640,30 +624,11 @@ public class ArticleDao {
        if(StringUtil.isNotEmpty(userCode)){
			param2.append(" and  a.UserId='"+userCode+"'");
//			param.append(" or  ( OperatorId='"+userCode+"' and UserScope=4 and RoleType = "+vo.getRoleType()+")");
		}
//		pageParam.append(" limit ").append(start * pageSize + "," + pageSize);
		sql.addVar("@Condition", param.toString());
		sql.addVar("@Condition2", param2.toString());
		sql.addVar("@PageParam", "");
//		List<Article> list = DB.me().queryForBeanList(MyDatabaseEnum.JkEduDB, sql,Article.class);
//		Category temp = null;
//		for(Article one:list){
//
//			temp = new Category();
//			temp.setCategoryLevel(1);
//			temp.setFirstlevelId(one.getFirstLevelCategoryId());
//			temp.setSecondLevelId(null);
//			com.common.json.JSONObject result = dao.getCategoryList( temp, 0, 1000);
//			one.setFirstLevelCategoryName(result.get("CategoryName")+"");
//			temp = new Category();
//			temp.setCategoryLevel(2);
//			temp.setFirstlevelId(null);
//			temp.setSecondLevelId(one.getSecondLevelCategoryId());
//			result = dao.getCategoryList( temp, 0, 1000);
//			one.setSecondLevelCategoryName(result.get("CategoryName")+"");
//		}
//		log.info("queryArticlePcList:"+sql.toString());
//		System.out.printf("queryArticlePcList:"+sql.toString());
		return DB.me().queryForJson(MyDatabaseEnum.JkEduDB, sql, start, pageSize);
@ -698,40 +663,29 @@ public class ArticleDao {
				switch(i){
					case 1:{
						temp+=" or (UserScope = 1 and OperatorRoleCode like '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,4)):vo.getOperatorRoleCode())+"%')";
//						temp+=" or (UserScope = 1 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,6)):vo.getOperatorRoleCode())+"')";
//						temp+=" or (UserScope = 1 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode()):vo.getOperatorRoleCode())+"')";
						break;}
					case 2:{
						temp+=" or (UserScope = 2 and OperatorRoleCode like '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,6)):vo.getOperatorRoleCode())+"%')";
//						temp+=" or (UserScope = 2 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode()):vo.getOperatorRoleCode())+"')";
						break;}
					case 3:{temp+=" or (UserScope = 3 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode()):vo.getOperatorRoleCode())+"')";break;}
				}
			}
			param3.append(temp.substring(3));
//			if(!StringUtils.isEmpty(temp)){
//				param3.append(temp.substring(3));
//				param3.append("  or (UserScope = ? and OperatorRoleCode =?) ");
//			}else{
//				param3.append("  (UserScope = ? and OperatorRoleCode =?) ");
//			}
//			sql.addParamValue(Integer.valueOf(vo.getOperatorRoleLevel())-1);
//			sql.addParamValue(vo.getOperatorRoleCode());
		}
		param3.append(" or  ( OperatorId='"+userCode+"' and UserScope=4 "+(vo.getRoleType()!=null?" and RoleType = "+vo.getRoleType().intValue():"")+" and OperatorRoleCode = '"+vo.getOperatorRoleCode()+"')");
		if("1".equals(vo.getOperatorRoleLevel())){//省
//			param.append(" and OperatorRoleCode like '"+vo.getOperatorRoleCode().substring(0,3)+"%' ");
		}else if("2".equals(vo.getOperatorRoleLevel())){//市
			param3.append(" or (OperatorRoleLevel= 1 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000 "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 1 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000"):vo.getOperatorRoleCode())+"') ");
		}else if("3".equals(vo.getOperatorRoleLevel())){//区
			param3.append(" or (OperatorRoleLevel= 1 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000 "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 2 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,4)+"00 "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 1 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000"):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 2 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,4)+"00"):vo.getOperatorRoleCode())+"') ");
		}else if("4".equals(vo.getOperatorRoleLevel())){//社区、机构
			param3.append(" or (OperatorRoleLevel= 1 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000 "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 2 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,4)+"00 "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 3 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,6)+" "):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 1 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,2)+"0000"):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 2 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,4)+"00"):vo.getOperatorRoleCode())+"') ");
			param3.append(" or (OperatorRoleLevel= 3 and UserScope != 4 and OperatorRoleCode = '"+(vo.getOperatorRoleCode().length()<=10?(vo.getOperatorRoleCode().substring(0,6)+""):vo.getOperatorRoleCode())+"') ");
		}
		param3.append(" or (OperatorRoleLevel= "+vo.getOperatorRoleLevel()+" and OperatorRoleCode = '"+vo.getOperatorRoleCode()+"' ) ");
		param3.append(" or (OperatorRoleLevel= "+vo.getOperatorRoleLevel()+" and UserScope != 4 and OperatorRoleCode = '"+vo.getOperatorRoleCode()+"' ) ");
		param.append("and ("+param3.toString()+")");
		if(isMyArticle&&vo.getRoleType()!=null) {
@ -778,23 +732,6 @@ public class ArticleDao {
//		System.out.printf("queryArticleAPPList:"+sql.toString());
		List<Article> list = DB.me().queryForBeanList(MyDatabaseEnum.JkEduDB, sql,Article.class);
		return list;
//		Category temp = null;
//		for(Article one:list){
//
//			temp = new Category();
//			temp.setCategoryLevel(1);
//			temp.setFirstlevelId(one.getFirstLevelCategoryId());
//			temp.setSecondLevelId(null);
//			com.common.json.JSONObject result = dao.getCategoryList( temp, 0, 1000);
//			one.setFirstLevelCategoryName(result.get("CategoryName")+"");
//			temp = new Category();
//			temp.setCategoryLevel(2);
//			temp.setFirstlevelId(null);
//			temp.setSecondLevelId(one.getSecondLevelCategoryId());
//			result = dao.getCategoryList( temp, 0, 1000);
//			one.setSecondLevelCategoryName(result.get("CategoryName")+"");
//		}
//		return DB.me().queryForJson(MyDatabaseEnum.JkEduDB, sql, start, pageSize);
	}
	/**

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

+ 19 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildFamilyImmuneDao.java

@ -0,0 +1,19 @@
package com.yihu.wlyy.repository.imm;
import com.yihu.wlyy.entity.imm.ChildFamilyImmune;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author huangwenjie
 * @date 2018/1/16 19:33
 */
public interface ChildFamilyImmuneDao extends PagingAndSortingRepository<ChildFamilyImmune, Long>,
		JpaSpecificationExecutor<ChildFamilyImmune> {
	
	@Query("select p from ChildFamilyImmune p where p.familyCode = ?1 and p.del = 0")
	List<ChildFamilyImmune> findByFamilyCode(String familycode);
}

+ 24 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/imm/ChildInfoDao.java

@ -0,0 +1,24 @@
package com.yihu.wlyy.repository.imm;
import com.yihu.wlyy.entity.imm.ChildInfo;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * @author huangwenjie
 * @date 2018/1/16 19:28
 */
public interface ChildInfoDao extends PagingAndSortingRepository<ChildInfo, Long>, JpaSpecificationExecutor<ChildInfo> {
	
	@Query("from ChildInfo p where p.barcode=?1 and del = 0")
	ChildInfo findByBarcode(String barcode);
	
	@Modifying
	@Query("update ChildInfo p set p.ssc=?2,p.idcard=?3 where p.barcode=?1")
	void updateIdcardAndSsc(String barcode,String ssc,String idcard);
	
	@Query("from ChildInfo p where p.code=?1 and del = 0")
	ChildInfo findByCode(String code);
}

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

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

+ 84 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildFamilyImmuneService.java

@ -0,0 +1,84 @@
package com.yihu.wlyy.service.imm;
import com.yihu.wlyy.entity.imm.ChildFamilyImmune;
import com.yihu.wlyy.entity.imm.ChildInfo;
import com.yihu.wlyy.repository.imm.ChildFamilyImmuneDao;
import com.yihu.wlyy.repository.imm.ChildInfoDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
 * 家人免疫关系业务层
 * @author huangwenjie
 * @date 2018/1/16 20:01
 */
@Service
public class ChildFamilyImmuneService extends BaseService {
	
	@Autowired
	private ChildFamilyImmuneDao childFamilyImmuneDao;
	@Autowired
	private ChildInfoDao childInfoDao;
	@Autowired
	JdbcTemplate jdbcTemplate;
	
	/**
	 * 绑定家庭成员免疫关系
	 * @param childInfo
	 * @param uid
	 * @param idcard
	 * @param ssc
	 * @param relation
	 */
	@Transactional
	public void addFamilyMembers(ChildInfo childInfo, String uid, String idcard, String ssc,Integer relation) throws Exception {
		ChildFamilyImmune childFamilyImmune = new ChildFamilyImmune();
		childFamilyImmune.setCode(UUID.randomUUID().toString());
		childFamilyImmune.setChildCode(childInfo.getCode());
		childFamilyImmune.setFamilyCode(uid);
		childFamilyImmune.setDel(0);
		childFamilyImmune.setCreate_time(new Date());
		childFamilyImmune.setRelation(relation);
		
		if(childInfo.getId() == 0
				|| StringUtils.isBlank(childInfo.getIdcard())
					|| StringUtils.isBlank(childInfo.getSsc())){
			childInfo.setIdcard(idcard);
			childInfo.setSsc(ssc);
			childInfoDao.save(childInfo);
		}
		childFamilyImmuneDao.save(childFamilyImmune);
	}
	
	/**
	 * 获取家人免疫关系成员列表
	 * @param repUID
	 * @return
	 */
	public List<Map<String, Object>> getImmunemembers(String repUID) {
		String sql = "select a.*," +
				"b.`name` as name," +
				"b.ssc as ssc," +
				"b.idcard as idcard," +
				"b.barcode as barcode," +
				"b.sex as sex," +
				"b.photo as photo " +
				"from wlyy_child_family_immune a " +
				"join wlyy_child_info b on b.code = a.child_code and b.del = 0 " +
				"where a.del = 0 and a.family_code = "+repUID;
		
		List<Map<String, Object>> rs = jdbcTemplate.queryForList(sql);
		return rs;
	}
}

+ 84 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/imm/ChildInfoService.java

@ -0,0 +1,84 @@
package com.yihu.wlyy.service.imm;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.imm.ChildInfo;
import com.yihu.wlyy.repository.imm.ChildInfoDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.service.third.guahao.ImmuneService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.UUID;
/**
 * 新生儿信息业务层
 * @author huangwenjie
 * @date 2018/1/16 19:38
 */
@Service
public class ChildInfoService extends BaseService {
	
	@Autowired
	private ChildInfoDao childInfoDao;
	@Autowired
	private ImmuneService immuneService;
	
	/**
	 * 根据编码获取新生儿信息
	 * @param barCode
	 * @return
	 */
	public ChildInfo getByBarCode(String barCode) throws Exception {
		//1.先根据新生儿编码查询本地数据库是否已有记录
		ChildInfo childInfo = childInfoDao.findByBarcode(barCode);
		//2.如果本地数据库无记录则请求基卫接口查询
		if(childInfo == null){
		    String re = immuneService.GetChildrenInfo(barCode);
			JSONObject data = JSONObject.parseObject(re);
			int status = data.getInteger("status");
			if(200 == status){
				childInfo = new ChildInfo();
				childInfo.setCode(UUID.randomUUID().toString());
				childInfo.setBirthday(data.getString("birthday"));
				childInfo.setSex(data.getString("sex"));
				childInfo.setName(data.getString("name"));
				childInfo.setDeliverOrgname(data.getString("deptName"));
				childInfo.setDeliverJworgcode(data.getString("deptNum"));
				childInfo.setDel(0);
				childInfo.setCreate_time(new Date());
			}else{
				throw new Exception("获取新生儿信息失败!");
			}
		}
		
		return childInfo;
	}
	
	/**
	 * 修改儿童免疫关系的身份证号和医保卡号
	 * @param barCode  新生儿编码
	 * @param ssc      新生儿医保卡号
	 * @param idcard   新生儿身份证号
	 * @return
	 */
	public void modifyImmuneMenberByBarCode(String barCode, String ssc, String idcard) throws Exception{
		ChildInfo childInfo = childInfoDao.findByBarcode(barCode);
		if(childInfo == null){
			throw new Exception("本地无该新生儿信息记录!");
		}else{
			childInfo.setSsc(ssc);
			childInfo.setIdcard(idcard);
			childInfoDao.save(childInfo);
		}
	}
	
	/**
	 * 根据新生儿CODE获取新生儿信息
	 * @param code
	 * @return
	 */
	public ChildInfo getChildInfoByCode(String code) throws Exception{
		return childInfoDao.findByCode(code);
	}
}

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

+ 505 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/guahao/ImmuneService.java

@ -0,0 +1,505 @@
package com.yihu.wlyy.service.third.guahao;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.organization.Hospital;
import com.yihu.wlyy.repository.organization.HospitalDao;
import com.yihu.wlyy.repository.organization.HospitalMappingDao;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.lang.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * 免疫接种预约挂号
 * @author huangwenjie
 * @date 2018/1/16 19:43
 */
@Service
public class ImmuneService {
	private static final Logger logger = LoggerFactory.getLogger(ImmuneService.class);
	//基卫服务地址
	@Value("${sign.check_upload}")
	private String jwUrl;
	@Autowired
	private HttpClientUtil httpClientUtil;
	@Autowired
	private JdbcTemplate jdbcTemplate;
	@Autowired
	private HospitalMappingDao hospitalMappingDao;
	@Autowired
	private HospitalDao hospitalDao;
	
	
	/**
	 * 计免:获取免疫接种儿童信息
	 * @param barcode 新生儿条码
	 * @return
	 * @throws Exception
	 */
	public String GetChildrenInfo(String barcode) throws Exception{
		String url = jwUrl + "/third/guahao/imm/GetChildrenInfo";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("barCode", barcode));
		
		String response = httpClientUtil.post(url, params, "UTF-8");
		
		return response;
	}
	
	/**
	 * 计免:获取免疫接种机构列表
	 * @return
	 * @throws Exception
	 */
	public List<Map<String,String>> getOrgImmuneList()throws Exception {
		
		List<Map<String, String>> re = new ArrayList<>();
		
		String url = jwUrl + "/third/guahao/imm/GetOrgImmuneList";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("Condition", ""));
		
		String response = httpClientUtil.post(url, params, "UTF-8");
		
		JSONObject data = JSONObject.parseObject(response);
		int status = data.getInteger("status");
		String xml = data.getString("data");
		if(200 == status && StringUtils.isNotBlank(xml)){
			Document document = DocumentHelper.parseText(xml);
			Element root = document.getRootElement();
			List<?> child = root.elements();
			for (Object o : child) {
				Element e = (Element) o;
				String shortName = e.attribute("short_name").getValue();//机构简称
				String code = e.attribute("code").getValue();//机构编码
				String name = e.getText();//机构全称
				String zone_name = e.attribute("zone_name").getValue();//行政区
				String zone_code = e.attribute("zone_code").getValue();//行政区编码
				Map<String, String> map = new HashMap<>();
				map.put("id", code);
				map.put("shortName", shortName);//机构简称
				map.put("name", name);//机构全称
				map.put("zone_name", zone_name);//行政区名称
				map.put("zone_code", zone_code);//行政区编码
				String photo = hospitalMappingDao.getPhotoByMappingCode(code, "1");
				map.put("photo", photo);
				re.add(map);
			}
		}else{
			throw new Exception("获取免疫接种机构列表息失败!");
		}
		
		return re;
	}
	
	/**
	 * 计免:获取免疫接种排班信息和号源信息
	 * @param orgCode
	 * @return
	 */
	public JSONObject getOrgScheduleAndNumberList(String orgCode) throws Exception{
	
		String url = jwUrl + "/imm/GetOrgScheduleAndNumberList";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("OrgCode", "orgCode"));
		String response = httpClientUtil.post(url, params, "UTF-8");
		JSONObject data = JSONObject.parseObject(response);
		int status = data.getInteger("status");
		String xml = data.getString("data");
//		int status = 200;
//		String xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
//				"<ArrayOfImmuneSchudleModel\n" +
//				"    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
//				"    xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" +
//				"    <ImmuneSchudleModel>\n" +
//				"        <ORG_ID>501</ORG_ID>\n" +
//				"        <ORG_CODE>350211A1025</ORG_CODE>\n" +
//				"        <ORG_NAME>新阳街道社区卫生服务中心</ORG_NAME>\n" +
//				"        <DateNumbers>\n" +
//				"            <DateNumber>\n" +
//				"                <SECTIONLIST>\n" +
//				"                    <Section>\n" +
//				"                        <ID>081000</ID>\n" +
//				"                        <MAX>1</MAX>\n" +
//				"                        <USED>0</USED>\n" +
//				"                        <START_TIME>2017-08-12T08:00:00</START_TIME>\n" +
//				"                        <END_TIME>2017-08-12T08:08:00</END_TIME>\n" +
//				"                        <TIME>AM</TIME>\n" +
//				"                        <PLATFORM_FLAG>0</PLATFORM_FLAG>\n" +
//				"                    </Section>\n" +
//				"                    <Section>\n" +
//				"                        <ID>081001</ID>\n" +
//				"                        <MAX>1</MAX>\n" +
//				"                        <USED>0</USED>\n" +
//				"                        <START_TIME>2017-08-12T15:00:00</START_TIME>\n" +
//				"                        <END_TIME>2017-08-12T15:08:00</END_TIME>\n" +
//				"                        <TIME>PM</TIME>\n" +
//				"                        <PLATFORM_FLAG>0</PLATFORM_FLAG>\n" +
//				"                    </Section>\n" +
//				"                </SECTIONLIST>\n" +
//				"                <ID>350211B10392017081802</ID>\n" +
//				"                <DATE>2017-08-18T00:00:00</DATE>\n" +
//				"                <TIME>PM</TIME>\n" +
//				"                <MAX>10</MAX>\n" +
//				"                <USED>0</USED>\n" +
//				"                <FEE>0</FEE>\n" +
//				"                <STATUS>1</STATUS>\n" +
//				"            </DateNumber>\n" +
//				"            <DateNumber>\n" +
//				"                <SECTIONLIST>\n" +
//				"                    <Section>\n" +
//				"                        <ID>081000</ID>\n" +
//				"                        <MAX>1</MAX>\n" +
//				"                        <USED>0</USED>\n" +
//				"                        <START_TIME>2017-08-12T08:00:00</START_TIME>\n" +
//				"                        <END_TIME>2017-08-12T08:08:00</END_TIME>\n" +
//				"                        <TIME>AM</TIME>\n" +
//				"                        <PLATFORM_FLAG>0</PLATFORM_FLAG>\n" +
//				"                    </Section>\n" +
//				"                    <Section>\n" +
//				"                        <ID>081001</ID>\n" +
//				"                        <MAX>1</MAX>\n" +
//				"                        <USED>0</USED>\n" +
//				"                        <START_TIME>2017-08-12T15:00:00</START_TIME>\n" +
//				"                        <END_TIME>2017-08-12T15:08:00</END_TIME>\n" +
//				"                        <TIME>PM</TIME>\n" +
//				"                        <PLATFORM_FLAG>0</PLATFORM_FLAG>\n" +
//				"                    </Section>\n" +
//				"                </SECTIONLIST>\n" +
//				"                <ID>350211B10392017081802</ID>\n" +
//				"                <DATE>2017-08-18T00:00:00</DATE>\n" +
//				"                <TIME>PM</TIME>\n" +
//				"                <MAX>10</MAX>\n" +
//				"                <USED>0</USED>\n" +
//				"                <FEE>0</FEE>\n" +
//				"                <STATUS>1</STATUS>\n" +
//				"            </DateNumber>\n" +
//				"        </DateNumbers>\n" +
//				"    </ImmuneSchudleModel>\n" +
//				"</ArrayOfImmuneSchudleModel>";
		
		
		
		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
		
		JSONObject result = new JSONObject();
		if(200 == status && StringUtils.isNotBlank(xml)){
			Document document = DocumentHelper.parseText(xml);
			Element ArrayOfImmuneSchudleModel = document.getRootElement();
			Element ImmuneSchudleModel = ArrayOfImmuneSchudleModel.element("ImmuneSchudleModel");
			Element ORG_ID = ImmuneSchudleModel.element("ORG_ID");
			Element ORG_CODE = ImmuneSchudleModel.element("ORG_CODE");
			Element ORG_NAME = ImmuneSchudleModel.element("ORG_NAME");
			result.put("ORG_CODE",ORG_CODE.getTextTrim());//机构ID
			result.put("ORG_NAME",ORG_NAME.getTextTrim());//机构名称
			String hospitalcode = hospitalMappingDao.getCodeByMapping(ORG_CODE.getTextTrim(), "1");
			Hospital hospital = hospitalDao.findByCode(hospitalcode);
			result.put("ORG_PHOTO",hospital.getPhoto());//机构图片
			result.put("ORG_PHONE",hospital.getPhone());//机构电话
			result.put("ORG_ADDRESS",hospital.getAddress());//机构地址
			result.put("ORG_INFO",hospital.getIntro());//机构简介
			
			//排班列表
			Element DateNumbers = ImmuneSchudleModel.element("DateNumbers");
			Iterator<Element> iterator = DateNumbers.elementIterator();
			JSONArray DateNumbersJSON = new JSONArray();
			while(iterator.hasNext()){
				JSONObject DateNumberJSON = new JSONObject();
				Element e = iterator.next();
				Element ID = e.element("ID");
				Element DATE = e.element("DATE");
				Element TIME = e.element("TIME");
				Element MAX = e.element("MAX");
				Element USED = e.element("USED");
				Element FEE = e.element("FEE");
				Element STATUS = e.element("STATUS");
				DateNumberJSON.put("ID",ID.getTextTrim());//排班ID
				DateNumberJSON.put("DATE",DATE.getTextTrim());//排班日期
				DateNumberJSON.put("TIME",TIME.getTextTrim());//上午或者下去
				DateNumberJSON.put("MAX",MAX.getTextTrim());//号源数量
				DateNumberJSON.put("USED",USED.getTextTrim());//已使用
				DateNumberJSON.put("FEE",FEE.getTextTrim());//费用
				DateNumberJSON.put("STATUS",STATUS.getTextTrim());//排班状态:1可用,0不可用
				
				
				Date datevo = dateFormat.parse(DATE.getTextTrim());
				DateNumberJSON.put("DATEVO", DateUtil.dateToStrLong(datevo));
				DateNumberJSON.put("WEEK",DateUtil.getWeekByDate(datevo));
				
				//号源
				Element SECTIONLIST = e.element("SECTIONLIST");
				Iterator<Element> iteratorSection = SECTIONLIST.elementIterator();
				JSONArray SECTIONLISTJSON = new JSONArray();
				while(iteratorSection.hasNext()){
					JSONObject SectionJSON = new JSONObject();
					Element f = iteratorSection.next();
					Element SectionID = f.element("ID");
					Element SectionMAX = f.element("MAX");
					Element SectionUSED = f.element("USED");
					Element SectionSTART_TIME = f.element("START_TIME");
					Element SectionEND_TIME = f.element("END_TIME");
					Element SectionTIME = f.element("TIME");
					Element SectionSectionPLATFORM_FLAG = f.element("PLATFORM_FLAG");
					SectionJSON.put("ID",SectionID.getTextTrim());//号源ID
					SectionJSON.put("MAX",SectionMAX.getTextTrim());//号源数量
					SectionJSON.put("USED",SectionUSED.getTextTrim());//已使用
					SectionJSON.put("START_TIME",SectionSTART_TIME.getTextTrim());//开始时间-预约用
					SectionJSON.put("END_TIME",SectionEND_TIME.getTextTrim());//结束时间-预约用
					SectionJSON.put("TIME",SectionTIME.getTextTrim());//上午或者下午
					SectionJSON.put("PLATFORM_FLAG",SectionSectionPLATFORM_FLAG.getTextTrim());//平台标志
					
					Date START_TIME_VO = dateFormat.parse(SectionSTART_TIME.getTextTrim());
					Date END_TIME_VO = dateFormat.parse(SectionEND_TIME.getTextTrim());
					SectionJSON.put("START_TIME_VO",DateUtil.dateToStrLong(START_TIME_VO));//开始时间-前端展示用
					SectionJSON.put("END_TIME_VO",DateUtil.dateToStrLong(END_TIME_VO));//结束时间-前端展示用
					
					SECTIONLISTJSON.add(SectionJSON);
				}
				DateNumberJSON.put("SECTIONLIST",SECTIONLISTJSON);
				DateNumbersJSON.add(DateNumberJSON);
			}
			
			result.put("DateNumbers",DateNumbersJSON);
			return result;
		}else{
			throw new Exception("获取免疫接种机构列表息失败!");
		}
	}
	/**
	 *免疫接种确认预约
	 * @param barCode
	 * @param orgCode
	 * @param sectionType
	 * @param strStart
	 * @param ssid
	 * @param patientName
	 * @param patientID
	 * @param patientPhone
	 * @return
	 */
	public String RegisterImmune(String barCode,
	                           String orgCode,
	                           String sectionType,
	                           String strStart,
	                           String ssid,
	                           String patientName,
	                           String patientID,
	                           String patientPhone) throws Exception{
		String url = jwUrl + "/third/guahao/imm/RegisterImmune";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("BarCode", barCode));
		params.add(new BasicNameValuePair("OrgCode", orgCode));
		params.add(new BasicNameValuePair("SectionType", sectionType));
		params.add(new BasicNameValuePair("strStart", strStart));
		params.add(new BasicNameValuePair("SSID", ssid));
		params.add(new BasicNameValuePair("PatientName", patientName));
		params.add(new BasicNameValuePair("PatientID", patientID));
		params.add(new BasicNameValuePair("PatientPhone", patientPhone));
		
		String response = httpClientUtil.post(url, params, "UTF-8");
		
		JSONObject data = JSONObject.parseObject(response);
		int status = data.getInteger("status");
		String xml = data.getString("data");
		if(200 != status || StringUtils.isBlank(xml)){
			throw new Exception("免疫接种预约失败!");
		}else{
			return response;
		}
	}
	
	/**
	 *免疫接种确认预约
	 * @param barCode
	 * @param orgCode
	 * @param sectionType
	 * @param strStart
	 * @param ssid
	 * @param patientName
	 * @param patientID
	 * @param patientPhone
	 * @return
	 */
	public String UnResRegisterImmune(String barCode,
	                             String orgCode,
	                             String sectionType,
	                             String strStart,
	                             String ssid,
	                             String patientName,
	                             String patientID,
	                             String patientPhone) throws Exception{
		String url = jwUrl + "/third/guahao/imm/UnResRegisterImmune";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("BarCode", barCode));
		params.add(new BasicNameValuePair("OrgCode", orgCode));
		params.add(new BasicNameValuePair("SectionType", sectionType));
		params.add(new BasicNameValuePair("strStart", strStart));
		params.add(new BasicNameValuePair("SSID", ssid));
		params.add(new BasicNameValuePair("PatientName", patientName));
		params.add(new BasicNameValuePair("PatientID", patientID));
		params.add(new BasicNameValuePair("PatientPhone", patientPhone));
		
		String response = httpClientUtil.post(url, params, "UTF-8");
		
		JSONObject data = JSONObject.parseObject(response);
		int status = data.getInteger("status");
		String xml = data.getString("data");
		if(200 != status || StringUtils.isBlank(xml)){
			throw new Exception("取消免疫接种失败!");
		}else{
			return response;
		}
	}
	
	/**
	 * 计免:根据条形码获取预约记录
	 * @param barCode  新生儿条码
	 * @return
	 * @throws Exception
	 */
	public JSONArray GetResImmuneListWithBarCode(String barCode) throws Exception{
		
		String url = jwUrl + "/third/guahao/imm/GetResImmuneListWithBarCode";
		List<NameValuePair> params = new ArrayList<>();
		params.add(new BasicNameValuePair("BarCode", barCode));
		String response = httpClientUtil.post(url, params, "UTF-8");
		JSONObject data = JSONObject.parseObject(response);
		int status = data.getInteger("status");
		String xml = data.getString("data");
//		int status = 200;
//		String xml = "<?xml version=\"1.0\" encoding=\"utf-16\"?>\n" +
//				"<ArrayOfV_RESERVATION_IMMUNE\n" +
//				"    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
//				"    xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">\n" +
//				"    <V_RESERVATION_IMMUNE>\n" +
//				"        <ORG_ID>502</ORG_ID>\n" +
//				"        <ORG_CODE>350211B1040</ORG_CODE>\n" +
//				"        <ORG_NAME>金山街道社区卫生服务中心</ORG_NAME>\n" +
//				"        <RES_DATE>2017-08-22</RES_DATE>\n" +
//				"        <REGISTER_TIME>2017-08-18T15:21:28</REGISTER_TIME>\n" +
//				"        <STATUS>1</STATUS>\n" +
//				"        <START_TIME>08:24</START_TIME>\n" +
//				"        <END_TIME>08:32</END_TIME>\n" +
//				"        <SOURCE xsi:nil=\"true\" />\n" +
//				"        <RES_TELEPHONE>18798989988</RES_TELEPHONE>\n" +
//				"        <CANCEL_DATE xsi:nil=\"true\" />\n" +
//				"        <NOTICE_STATUS xsi:nil=\"true\" />\n" +
//				"        <NOTICE_DATE xsi:nil=\"true\" />\n" +
//				"        <NUMBER_ID>084550</NUMBER_ID>\n" +
//				"        <NAME>刘柠</NAME>\n" +
//				"        <CARD_NO>D20111110</CARD_NO>\n" +
//				"        <ID_CARD>350426199009203039</ID_CARD>\n" +
//				"        <RES_ID>6b8c2b58d4254bc9b1c945cb8c90cb9e</RES_ID>\n" +
//				"        <UPDATE_TIME xsi:nil=\"true\" />\n" +
//				"        <CREATE_TIME xsi:nil=\"true\" />\n" +
//				"        <UPLOAD_STATUS xsi:nil=\"true\" />\n" +
//				"        <DATA_STATUS xsi:nil=\"true\" />\n" +
//				"        <IS_CORRECT xsi:nil=\"true\" />\n" +
//				"        <LOCAL_SOURCE xsi:nil=\"true\" />\n" +
//				"        <START_TIME_RATE xsi:nil=\"true\" />\n" +
//				"        <END_TIME_RATE xsi:nil=\"true\" />\n" +
//				"        <BARCODE>0052248552</BARCODE>\n" +
//				"     </V_RESERVATION_IMMUNE>\n" +
//				"     <V_RESERVATION_IMMUNE>\n" +
//				"        <ORG_ID>502</ORG_ID>\n" +
//				"        <ORG_CODE>350211B1040</ORG_CODE>\n" +
//				"        <ORG_NAME>金山街道社区卫生服务中心</ORG_NAME>\n" +
//				"        <RES_DATE>2017-08-22</RES_DATE>\n" +
//				"        <REGISTER_TIME>2017-08-18T15:21:28</REGISTER_TIME>\n" +
//				"        <STATUS>1</STATUS>\n" +
//				"        <START_TIME>08:24</START_TIME>\n" +
//				"        <END_TIME>08:32</END_TIME>\n" +
//				"        <SOURCE xsi:nil=\"true\" />\n" +
//				"        <RES_TELEPHONE>18798989988</RES_TELEPHONE>\n" +
//				"        <CANCEL_DATE xsi:nil=\"true\" />\n" +
//				"        <NOTICE_STATUS xsi:nil=\"true\" />\n" +
//				"        <NOTICE_DATE xsi:nil=\"true\" />\n" +
//				"        <NUMBER_ID>084550</NUMBER_ID>\n" +
//				"        <NAME>刘柠</NAME>\n" +
//				"        <CARD_NO>D20111110</CARD_NO>\n" +
//				"        <ID_CARD>350426199009203039</ID_CARD>\n" +
//				"        <RES_ID>6b8c2b58d4254bc9b1c945cb8c90cb9e</RES_ID>\n" +
//				"        <UPDATE_TIME xsi:nil=\"true\" />\n" +
//				"        <CREATE_TIME xsi:nil=\"true\" />\n" +
//				"        <UPLOAD_STATUS xsi:nil=\"true\" />\n" +
//				"        <DATA_STATUS xsi:nil=\"true\" />\n" +
//				"        <IS_CORRECT xsi:nil=\"true\" />\n" +
//				"        <LOCAL_SOURCE xsi:nil=\"true\" />\n" +
//				"        <START_TIME_RATE xsi:nil=\"true\" />\n" +
//				"        <END_TIME_RATE xsi:nil=\"true\" />\n" +
//				"        <BARCODE>0052248552</BARCODE>\n" +
//				"     </V_RESERVATION_IMMUNE>\n" +
//				"</ArrayOfV_RESERVATION_IMMUNE>";
		
		
		
//		SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
		
		JSONArray result = new JSONArray();
		
		if(200 == status && StringUtils.isNotBlank(xml)){
			Document document = DocumentHelper.parseText(xml);
			Element ArrayOfV_RESERVATION_IMMUNE = document.getRootElement();
			
			Iterator<Element> iterator = ArrayOfV_RESERVATION_IMMUNE.elementIterator();
			while(iterator.hasNext()){
				JSONObject V_RESERVATION_IMMUNE_JSON = new JSONObject();
				Element f = iterator.next();
				Element ORG_CODE = f.element("ORG_CODE");
				Element ORG_NAME = f.element("ORG_NAME");
				Element RES_DATE = f.element("RES_DATE");
				Element REGISTER_TIME = f.element("REGISTER_TIME");
				Element STATUS = f.element("STATUS");
				Element START_TIME = f.element("START_TIME");
				Element END_TIME = f.element("END_TIME");
				Element RES_TELEPHONE = f.element("RES_TELEPHONE");
				Element NUMBER_ID = f.element("NUMBER_ID");
				Element NAME = f.element("NAME");
				Element CARD_NO = f.element("CARD_NO");
				Element ID_CARD = f.element("ID_CARD");
				Element RES_ID = f.element("RES_ID");
				Element BARCODE = f.element("BARCODE");
				
				V_RESERVATION_IMMUNE_JSON.put("ORG_CODE", ORG_CODE.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("ORG_NAME", ORG_NAME.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("RES_DATE", RES_DATE.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("REGISTER_TIME", REGISTER_TIME.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("STATUS", STATUS.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("START_TIME", START_TIME.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("END_TIME", END_TIME.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("RES_TELEPHONE", RES_TELEPHONE.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("NUMBER_ID", NUMBER_ID.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("NAME", NAME.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("CARD_NO", CARD_NO.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("ID_CARD", ID_CARD.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("RES_ID", RES_ID.getTextTrim());
				V_RESERVATION_IMMUNE_JSON.put("BARCODE", BARCODE.getTextTrim());
				result.add(V_RESERVATION_IMMUNE_JSON);
			}
			
			return result;
			
		}else{
			throw new Exception("获取免疫接种机构列表息失败!");
		}
	}
}

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

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

@ -1222,4 +1222,16 @@ public class DateUtil {
		ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
		return format.format(ca.getTime());
	}
	
	/**
	 * 根据日期对象返回星期几
	 * @param date
	 * @return
	 */
	public static int getWeekByDate(Date date){
		Calendar c = Calendar.getInstance();
		c.setTime(date);
		int week = c.get(Calendar.DAY_OF_WEEK);
		return week;
	}
}

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

+ 127 - 13
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/booking/PatientBookingController.java

@ -1,12 +1,15 @@
package com.yihu.wlyy.web.patient.booking;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.imm.ChildInfo;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientReservation;
import com.yihu.wlyy.service.app.reservation.PatientReservationService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.imm.ChildInfoService;
import com.yihu.wlyy.service.third.guahao.GuahaoXMService;
import com.yihu.wlyy.service.third.guahao.GuahaoYihuService;
import com.yihu.wlyy.service.third.guahao.ImmuneService;
import com.yihu.wlyy.service.third.jw.JwSmjkService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.web.WeixinBaseController;
@ -24,6 +27,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
 * 预约挂号
 * Created by yeshijie on 2017/2/4..
@ -46,6 +52,10 @@ public class PatientBookingController extends WeixinBaseController{
    private JwSmjkService jwSmjkService;
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private ChildInfoService childInfoService;
    @Autowired
    private ImmuneService immuneService;
    @RequestMapping(value = "CancelOrder", method = RequestMethod.POST)
@ -131,29 +141,133 @@ public class PatientBookingController extends WeixinBaseController{
        }
    }
    
    //-----------------计划免疫预约相关接口--------------START
    /**
     *-----------------计划免疫预约相关接口--------------START
     */
    
    @RequestMapping(value = "getChildrenInfo", method = RequestMethod.POST)
    @RequestMapping(value = "/imm/getChildrenInfo", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("根据条形编码获取儿童信息")
    public String getChildrenInfo (@ApiParam(name = "barCode", value = "条形编码", defaultValue = "")
    @ApiOperation("计免:获取免疫接种儿童信息")
    public String getChildrenInfo (@ApiParam(name = "barCode", value = "条形编码", defaultValue = "0052248552")
                                   @RequestParam(value = "barCode", required = true) String barCode){
    
        try{
            return "";
//            String
////            PatientReservation obj = patientReservationService.findById(orderId);
//            if(obj != null){
//
//            }else{
//                return error(-1, "该条码对应的儿童信息不存在");
//            }
            ChildInfo childInfo  = childInfoService.getByBarCode(barCode);
            return write(200, "查询成功","data",childInfo);
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    @RequestMapping(value = "/imm/GetOrgImmuneList", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:获取免疫接种机构列表")
    public String GetOrgImmuneList (){
        
        try{
            List<Map<String, String>> list = immuneService.getOrgImmuneList();
            return write(200, "查询成功","data",list);
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    @RequestMapping(value = "/imm/GetOrgScheduleAndNumberList", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:获取免疫接种排班信息和号源信息")
    public String GetOrgScheduleAndNumberList (@ApiParam(name = "orgCode", value = "机构编码", defaultValue = "")
                                                   @RequestParam(value = "orgCode", required = true) String orgCode){
        
        try{
            com.alibaba.fastjson.JSONObject result = immuneService.getOrgScheduleAndNumberList(orgCode);
            return write(200, "查询成功","data",result);
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    @RequestMapping(value = "/imm/RegisterImmune", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:免疫接种确认预约")
    public String RegisterImmune (@ApiParam(name="BarCode",value="新生儿条形编码",defaultValue = "")
                                      @RequestParam String BarCode,
                                  @ApiParam(name="OrgCode",value="机构编码",defaultValue = "")
                                      @RequestParam String OrgCode,
                                  @ApiParam(name="SectionType",value="坐诊类型:取号源的TIME",defaultValue = "")
                                      @RequestParam String SectionType,
                                  @ApiParam(name="strStart",value="日期:取号源的START_TIME",defaultValue = "")
                                      @RequestParam String strStart,
                                  @ApiParam(name="SSID",value="新生儿社保卡号",defaultValue = "")
                                      @RequestParam String SSID,
                                  @ApiParam(name="PatientName",value="新生儿姓名",defaultValue = "")
                                      @RequestParam String PatientName,
                                  @ApiParam(name="PatientID",value="新生儿身份证号",defaultValue = "")
                                      @RequestParam String PatientID,
                                  @ApiParam(name="PatientPhone",value="市民手机号:代预约人的手机号",defaultValue = "")
                                      @RequestParam String PatientPhone){
        
        try{
            immuneService.RegisterImmune(BarCode,OrgCode,SectionType,strStart,SSID,PatientName,PatientID,PatientPhone);
            return write(200, "预约成功");
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    @RequestMapping(value = "/imm/UnResRegisterImmune", method = RequestMethod.POST)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:免疫接种取消预约")
    public String UnResRegisterImmune (@ApiParam(name="BarCode",value="新生儿条形编码",defaultValue = "")
                                  @RequestParam String BarCode,
                                  @ApiParam(name="OrgCode",value="机构编码",defaultValue = "")
                                  @RequestParam String OrgCode,
                                  @ApiParam(name="SectionType",value="坐诊类型:取号源的TIME",defaultValue = "")
                                  @RequestParam String SectionType,
                                  @ApiParam(name="strStart",value="日期:取号源的START_TIME",defaultValue = "")
                                  @RequestParam String strStart,
                                  @ApiParam(name="SSID",value="新生儿社保卡号",defaultValue = "")
                                  @RequestParam String SSID,
                                  @ApiParam(name="PatientName",value="新生儿姓名",defaultValue = "")
                                  @RequestParam String PatientName,
                                  @ApiParam(name="PatientID",value="新生儿身份证号",defaultValue = "")
                                  @RequestParam String PatientID,
                                  @ApiParam(name="PatientPhone",value="市民手机号:代预约人的手机号",defaultValue = "")
                                  @RequestParam String PatientPhone){
        
        try{
            immuneService.UnResRegisterImmune(BarCode,OrgCode,SectionType,strStart,SSID,PatientName,PatientID,PatientPhone);
            return write(200, "取消预约成功");
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    @RequestMapping(value = "/imm/GetResImmuneListWithBarCode", method = RequestMethod.GET)
    @ResponseBody
    @ObserverRequired
    @ApiOperation("计免:根据条形码获取预约记录")
    public String UnResRegisterImmune (@ApiParam(name="BarCode",value="新生儿条形编码",defaultValue = "")
                                       @RequestParam String BarCode){
        
        try{
            com.alibaba.fastjson.JSONArray result = immuneService.GetResImmuneListWithBarCode(BarCode);
            return write(200, "查询成功!","data",result);
        }catch (Exception e){
            error(e);
            return error(-1, e.getMessage());
        }
    }
    
    //-----------------计划免疫预约相关接口--------------END
    /**
     *-----------------计划免疫预约相关接口--------------END
     */
}

+ 70 - 21
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/family/FamilyMemberController.java

@ -1,10 +1,13 @@
package com.yihu.wlyy.web.patient.family;
import com.yihu.wlyy.entity.imm.ChildInfo;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientFamilyMember;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientFamilyMemberDao;
import com.yihu.wlyy.service.app.family.FamilyMemberService;
import com.yihu.wlyy.service.imm.ChildFamilyImmuneService;
import com.yihu.wlyy.service.imm.ChildInfoService;
import com.yihu.wlyy.util.MD5;
import com.yihu.wlyy.web.WeixinBaseController;
import io.swagger.annotations.Api;
@ -16,6 +19,9 @@ import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
 * 家庭关系成员控制器
 * <p>
@ -32,6 +38,11 @@ public class FamilyMemberController extends WeixinBaseController {
    PatientFamilyMemberDao familyMemberDao;
    @Autowired
    PatientDao patientDao;
    @Autowired
    private ChildInfoService childInfoService;
    @Autowired
    private ChildFamilyImmuneService childFamilyImmuneService;
    
    /**
     * 添加成员
@ -198,16 +209,18 @@ public class FamilyMemberController extends WeixinBaseController {
    public String getPatientFamilyMembers(@RequestParam(required = false) String patient,
                                          @RequestParam(required = false) Integer isAgree) {
        try {
            JSONObject data = new JSONObject();
            JSONArray result = new JSONArray();
            if (StringUtils.isNotEmpty(patient)) {
                result = familyMemberService.getPatientMembers(patient, "", true, getUID(),isAgree);
            } else  {
                result = familyMemberService.getPatientFamilyMembers(getUID(), "",null);
            }
            List<Map<String, Object>>  immrs = childFamilyImmuneService.getImmunemembers(getRepUID());
//            List<Map<String, Object>>  immrs = childFamilyImmuneService.getImmunemembers("22");
            
            JSONObject data = new JSONObject();
            data.put("normalmembers",result);//家人关系
            data.put("immunemembers","");//免疫关系
            data.put("immunemembers",immrs);//免疫关系
            
            return write(200, "查询成功", "data", data);
        } catch (Exception e) {
@ -462,31 +475,67 @@ public class FamilyMemberController extends WeixinBaseController {
        return write(200,loginPassword);
    }
    
    /**
     * 免疫接种相关接口==============================START===============================
     */
    
    @RequestMapping(value = "/addImmuneMenberByBarCode", method = RequestMethod.POST)
    @ApiOperation(value = "根据儿童编码绑定家人免疫关系")
    public String addImmuneMenberByBarCode(@ApiParam(name = "barCode", value = "条形编码", defaultValue = "")
                                        @RequestParam(value = "barCode", required = true) String barCode){
    public String addImmuneMenberByBarCode(@ApiParam(name = "barCode", value = "新生儿条形编码", defaultValue = "")
                                           @RequestParam(value = "barCode", required = true) String barCode,
                                           @ApiParam(name = "idcard", value = "新生儿身份证号", defaultValue = "")
                                           @RequestParam(value = "idcard", required = true) String idcard,
                                           @ApiParam(name = "ssc", value = "新生儿条形编码", defaultValue = "")
                                           @RequestParam(value = "ssc", required = true) String ssc,
                                           @ApiParam(name = "relation", value = "1父亲 2母亲 3老公 4老婆 5儿子 6女儿 7其他")
                                           @RequestParam(value = "relation", required = true) Integer relation){
        try {
    
            ChildInfo childInfo  = childInfoService.getByBarCode(barCode);
            
            int result = 0;
            
            if(result==0){
                return error(-1, "不能添加自己");
            }else if(result==-1){
                return error(-1, "居民信息查询失败");
            }else if(result==-2){
                return error(-1, "该成员未注册");
            }else if (result == -4) {
                return error(-1, "该家庭成员已存在");
            }else if(result==-5){
                return error(-1, "该家庭关系已存在成员");
            }else if(result ==2) {
                return write(200, "拒绝成功");
            }else{
                return write(200, "添加成功");
            if(!idcard.equals(childInfo.getIdcard()) && StringUtils.isNotBlank(childInfo.getIdcard())){
                return error(-1, "新生儿身份证信息不一致,无法绑定");
            }
    
            if(!ssc.equals(childInfo.getSsc()) && StringUtils.isNotBlank(childInfo.getSsc())){
                return error(-1, "新生儿身份证信息不一致,无法绑定");
            }
    
            childFamilyImmuneService.addFamilyMembers(childInfo,getRepUID(),idcard,ssc,relation);
    
            return write(200,"绑定成功!");
        } catch (Exception e) {
            return error(-1, "绑定失败!");
        }
    }
    
    @RequestMapping(value = "/modifyImmuneMenberByBarCode", method = RequestMethod.POST)
    @ApiOperation(value = "修改儿童免疫关系的身份证号和医保卡号")
    public String modifyImmuneMenberByBarCode(@ApiParam(name = "barCode", value = "新生儿条形编码", defaultValue = "")
                                           @RequestParam(value = "barCode", required = true) String barCode,
                                           @ApiParam(name = "idcard", value = "新生儿身份证号", defaultValue = "")
                                           @RequestParam(value = "idcard", required = true) String idcard,
                                           @ApiParam(name = "ssc", value = "新生儿条形编码", defaultValue = "")
                                           @RequestParam(value = "ssc", required = true) String ssc){
        try {
            
            childInfoService.modifyImmuneMenberByBarCode(barCode,ssc,idcard);
            return write(200,"修改成功!");
        } catch (Exception e) {
            return error(-1, "修改失败!");
        }
    }
    
    @RequestMapping(value = "/getImmChildInfo", method = RequestMethod.GET)
    @ApiOperation(value = "根据新生儿编码获取新生儿基础信息")
    public String getImmChildInfo(@ApiParam(name = "code", value = "新生儿CODE", defaultValue = "")
                                  @RequestParam(value = "code", required = true) String code){
        try {
            
            ChildInfo childInfo = childInfoService.getChildInfoByCode(code);
            return write(200,"查询成功!","data",childInfo);
        } catch (Exception e) {
            return error(-1, "绑定失败");
            return error(-1, "查询失败!");
        }
    }
}

+ 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();
    }
    /**
     * 设置微信公共的图文消息
     *

+ 13 - 17
patient-co/patient-co-wlyy/src/main/resources/logback.xml

@ -11,9 +11,9 @@
    </appender>
    <appender name="rollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/Users/Mewtwo/ideaSpace/log/tmp/logs/wlyy.log</file>
        <file>/tmp/logs/wlyy.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/Users/Mewtwo/ideaSpace/log/tmp/logs/wlyy.%d{yyyy-MM-dd}.log</fileNamePattern>
            <fileNamePattern>/tmp/logs/wlyy.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>15</maxHistory>
        </rollingPolicy>
        <encoder>
@ -23,9 +23,9 @@
    </appender>
    <appender name="business_m" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/Users/Mewtwo/ideaSpace/log/wlyy_logs/business_m.log</file>
        <file>/datadisk/wlyy_logs/business_m.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/Users/Mewtwo/ideaSpace/log/wlyy_logs/rolling/business_m.%d{yyyy-MM-dd_HH-mm}.log</fileNamePattern>
            <fileNamePattern>/datadisk/wlyy_logs/rolling/business_m.%d{yyyy-MM-dd_HH-mm}.log</fileNamePattern>
            <maxHistory>15</maxHistory>
        </rollingPolicy>
        <encoder>
@ -34,9 +34,9 @@
        </encoder>
    </appender>
    <appender name="business_d" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/Users/Mewtwo/ideaSpace/log/wlyy_logs/business.log</file>
        <file>/datadisk/wlyy_logs/business.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/Users/Mewtwo/ideaSpace/log/wlyy_logs/dayLogs/business.%d{yyyy-MM-dd}.log</fileNamePattern>
            <fileNamePattern>/datadisk/wlyy_logs/dayLogs/business.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>15</maxHistory>
        </rollingPolicy>
        <encoder>
@ -45,9 +45,9 @@
        </encoder>
    </appender>
    <appender name="interface_call_m" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/Users/Mewtwo/ideaSpace/log/wlyy_logs/interface_call_m.log</file>
        <file>/datadisk/wlyy_logs/interface_call_m.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/Users/Mewtwo/ideaSpace/log/wlyy_logs/rolling/interface_call_m.%d{yyyy-MM-dd_HH-mm}.log</fileNamePattern>
            <fileNamePattern>/datadisk/wlyy_logs/rolling/interface_call_m.%d{yyyy-MM-dd_HH-mm}.log</fileNamePattern>
            <maxHistory>15</maxHistory>
        </rollingPolicy>
        <encoder>
@ -56,9 +56,9 @@
        </encoder>
    </appender>
    <appender name="interface_call_d" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/Users/Mewtwo/ideaSpace/log/wlyy_logs/interface_call.log</file>
        <file>/datadisk/wlyy_logs/interface_call.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>/Users/Mewtwo/ideaSpace/log/wlyy_logs/dayLogs/interface_call.%d{yyyy-MM-dd}.log</fileNamePattern>
            <fileNamePattern>/datadisk/wlyy_logs/dayLogs/interface_call.%d{yyyy-MM-dd}.log</fileNamePattern>
            <maxHistory>15</maxHistory>
        </rollingPolicy>
        <encoder>
@ -90,10 +90,10 @@
    <!--处方支付日志 start-->
    <!-- 演示按时间滚动的策略 -->
    <appender name="dailyRollingFileAppender" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <File>/Users/Mewtwo/ideaSpace/log/tmp/logs/wlyy_prescription_pay.log</File>
        <File>/tmp/logs/wlyy_prescription_pay.log</File>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- daily rollover -->
            <FileNamePattern>/Users/Mewtwo/ideaSpace/log/tmp/logs/wlyy_prescription_pay.%d{yyyy-MM-dd}.log</FileNamePattern>
            <FileNamePattern>/tmp/logs/wlyy_prescription_pay.%d{yyyy-MM-dd}.log</FileNamePattern>
            <!-- 保留 15天数据,默认无限
            <maxHistory>15</maxHistory>-->
        </rollingPolicy>
@ -106,8 +106,6 @@
    </logger>
    <!--处方支付日志 end-->
    <appender name="error_rollingFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>/datadisk/wlyy_logs/error/error.log</file>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
@ -128,6 +126,4 @@
        <!--<appender-ref ref="console" />-->
        <appender-ref ref="rollingFile" />
    </root>
</configuration>
</configuration>

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