浏览代码

代码修改

yeshijie 7 年之前
父节点
当前提交
9e14610486
共有 32 个文件被更改,包括 994 次插入118 次删除
  1. 59 42
      common/common-entity/src/main/java/com/yihu/es/entity/HealthEduArticleES.java
  2. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/device/PatientDevice.java
  3. 6 3
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientAimBloodPressure.java
  4. 6 3
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientAimBloodSugger.java
  5. 9 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/TrackPatient.java
  6. 15 1
      edu-article/JkEdu/WebRoot/WEB-INF/classes/Article.sql.xml
  7. 8 1
      edu-article/JkEdu/WebRoot/WEB-INF/classes/articlePc.sql.xml
  8. 二进制
      edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/ArticleDao.class
  9. 24 10
      edu-article/JkEdu/src/Article.sql.xml
  10. 3 3
      edu-article/JkEdu/src/articlePc.sql.xml
  11. 10 0
      edu-article/JkEdu/src/com/yihu/jk/action/ArticleAction.java
  12. 6 6
      edu-article/JkEdu/src/com/yihu/jk/api/ArticleApiTest.java
  13. 3 4
      edu-article/JkEdu/src/com/yihu/jk/dao/ArticleDao.java
  14. 1 1
      edu-article/JkEdu/src/com/yihu/jk/enums/ArticleSqlNameEnum.java
  15. 2 1
      edu-article/JkEdu/src/com/yihu/jk/vo/OrgArticleVo.java
  16. 5 0
      patient-co-service/wlyy_device/pom.xml
  17. 12 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/DoctorSwitchDao.java
  18. 17 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/TrackPatientDao.java
  19. 50 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/DoctorSwitch.java
  20. 104 0
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/TrackPatient.java
  21. 144 1
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  22. 1 1
      patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java
  23. 167 0
      patient-co/patient-co-wlyy/doc/技术文档/es/健教文章新增索引.txt
  24. 35 10
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  25. 227 18
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/scheme/DoctorSchemeService.java
  26. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java
  27. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  28. 21 6
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java
  29. 42 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheme/DoctroSchemeController.java
  30. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcLableController.java
  31. 9 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/HealthEduArticlePatientModel.java
  32. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/jkedu/controller/doctor/EduLableController.java

+ 59 - 42
common/common-entity/src/main/java/com/yihu/es/entity/HealthEduArticleES.java

@ -16,54 +16,60 @@ import java.util.List;
public class HealthEduArticleES {
public class HealthEduArticleES {
    @JestId
    @JestId
    private String id;
    private String id;
    private String batchNo;//批次号记录发送所属批次
    private String patientCode; // 患者标识
    private String patientName; // 患者名称
    private String doctorCode;  //发送人code(如管理员推送,保存登陆者code)
    private String doctorName;  //发送人名称(如管理员推送,保存登陆者name)
//    private String sendCode;   // 发送人code(如管理员推送,保存登陆者code)
    private String sendName;   // 推送的医生名称(包括医生本人、卫计委)
    private String sendPic;   // 发送人头像
    private String sendSex;   // 发送人性别
    private Long adminTeamCode;// 行政团队
    private String adminTeamName;// 行政团队
    private String hospital; // 所属机构
    private String hospitalName; // 所属机构
    private String town; // 所属区划
    private String townName; // 所属区划
    //说明:如医生推送文章给5个居民,则保存5条userType=1的记录和1条userType=2的记录(共6条)batchNo批次号一样。
    private String batchNo;//批次号记录发送所属批次(ES:必填)
    private String patientCode; // 患者标识(ES)(根据userType的值,userType=1,必填;userType=2,为空)
    private String patientName; // 患者名称(ES)(根据userType的值,userType=1,必填;userType=2,为空)
    private String doctorCode;  //发送人code(doctor表中的code)(ES:必填)
    private String doctorName;  //发送人名称(doctor表中的name)(ES:必填)
    private String sendName;   // 推送人的名称(包括医生本人、卫计委)(ES:必填)(如医生本人推送则记录医生名称,如管理员推送则记录管理员的角色名称)
    //备注:从发送人的信息中获取(doctor表获取)
    private String sendPic;   // 发送人头像(ES)
    private String sendSex;   // 发送人性别(ES)
    private Long adminTeamCode;// 行政团队(ES)
    private String adminTeamName;// 行政团队(ES)
    private String hospital; // 所属机构(ES)
    private String hospitalName; // 所属机构(ES)
    private String town; // 所属区划(ES)
    private String townName; // 所属区划(ES)
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd'T'HHmmss.SSS'Z'")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd'T'HHmmss.SSS'Z'")
    @CreatedDate
    @CreatedDate
    private Date createTime;  // 创建时间
    private Integer sendType;//发送类型 1医生发送 2(管理员)卫纪委发送
    private String sendLevel;   // 发送人级别  1专科医生,2全科医生,3健康管理师 4 管理员
    private String articleId;  //文章id
    private String articleTitle;  //文章标题
    private String articleCover;//文章封面
    private String articleContent; //文章内容
    private String articleCategoryId;//文章类别
    private String firstLevelCategoryId;//文章一级类别id
    private String firstLevelCategoryName;//文章一级类别Name
    private String secondLevelCategoryId;//文章二级类别id
    private String secondLevelCategoryName;//文章二级类别Name
    private String operatorId;//文章作者Id
    private Integer isRead=0;//文章是否已读 0未读,1已读
    private String articleSource;//文章来源
    private List<RoleVo> roleList;//发送者角色
    private String leaveWords;//医生留言
    private String currentUserRoleCode;//发送者当前登录的角色code  currentUserRoleCode与currentUserRoleLevel要一一对应取
    private String currentUserRoleLevel;//发送者当前登录的角色级别  省,市,区,机构,对应1.2.3.4   旧数据默认是2
    private Integer sendSource; //1或者为空 i健康后台推送  2PC端推送
    private Integer allCount;//所有的推送数目
    private Long readNumber;//阅读数(备注和浏览数不一样)
    private Date createTime;  // 创建时间(ES:必填)
    private Integer sendType;//发送类型 1医生发送 2(管理员)卫纪委发送(ES:必填)
    private String sendLevel;   // 发送人级别  1专科医生,2全科医生,3健康管理师 4 管理员(ES)
    private String articleId;  //文章id(ES:必填)
    private String articleTitle;  //文章标题(ES:必填)
    private String articleCover;//文章封面(ES:必填)
    private String articleContent; //文章内容(ES:必填)
    private String articleCategoryId;//文章类别(ES:必填)
    private String firstLevelCategoryId;//文章一级类别id(ES:必填)
    private String firstLevelCategoryName;//文章一级类别Name(ES:必填)
    private String secondLevelCategoryId;//文章二级类别id(ES:必填)
    private String secondLevelCategoryName;//文章二级类别Name(ES:必填)
    private String operatorId;//文章作者Id(ES:必填)
    private Integer isRead=0;//文章是否已读 0未读,1已读(ES:必填)
    private String articleSource;//文章来源(ES:必填)(备注:医生所属机构名称)
    private List<RoleVo> roleList;//发送者角色List(ES:非必填)(备注:管理员有值,普通医生为空)
    private String leaveWords;//医生留言(ES:非必填)
    //说明:如普通医生推送则保存doctor表中的hospital字段,如管理员推送则保存当前角色的code(取wlyy_user_role表中的role字段)
    private String currentUserRoleCode;//发送者当前登录的角色code(ES:必填)
    private String currentUserRoleLevel;//发送者当前登录的角色级别,1、省,2、市,3、区,4、机构(ES:必填)
    private Integer sendSource; //1或者为空 i健康后台推送  2PC端推送(默认旧数据为1)(为后续平台推送统计做备用字段)
    private Integer allCount;//所有的推送数目(ES:必填)
    private Long readNumber;//阅读数(备注:和浏览数不一样)(不保存ES)
    @Transient
    @Transient
    private Boolean newArricleFlag;//新版文章推送标志
    private Boolean newArricleFlag;//新版文章推送标志(不保存ES)
    private Integer userType; // 1、患者,2医生
    //说明:如医生推送文章给5个居民,则保存5条userType=1的记录和1条userType=2的记录(共6条)
    //业务需求:userType=1为居民被推送文章列表;userType=2医生推送的文章列表;
    private Integer userType; // 1、患者,2医生(ES:必填)
    private Date czrq;//阅读时间(默认为空,isRead=0;如isRead=1已读,则该字段有值)(ES:非必填)
    public String getId() {
    public String getId() {
        return id;
        return id;
@ -376,4 +382,15 @@ public class HealthEduArticleES {
    public void setReadNumber(Long readNumber) {
    public void setReadNumber(Long readNumber) {
        this.readNumber = readNumber;
        this.readNumber = readNumber;
    }
    }
    public Date getCzrq() {
        return czrq;
    }
    public void setCzrq(Date czrq) {
        this.czrq = czrq;
    }
    public HealthEduArticleES() {
    }
}
}

+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/device/PatientDevice.java

@ -14,7 +14,7 @@ public class PatientDevice extends IdEntity {
	// 设备ID
	// 设备ID
	private Long deviceId;
	private Long deviceId;
	// 设备标识
	// 设备标识 1血糖仪,2.血压计
	private String deviceSn;
	private String deviceSn;
	//sim卡号
	//sim卡号
	private String sim;
	private String sim;

+ 6 - 3
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientAimBloodPressure.java

@ -1,9 +1,11 @@
package com.yihu.wlyy.entity.patient;
package com.yihu.wlyy.entity.patient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.*;
import javax.persistence.*;
import java.sql.Timestamp;
import java.sql.Timestamp;
import java.util.Date;
/**
/**
 * 患者监测目标-血压
 * 患者监测目标-血压
@ -20,7 +22,7 @@ public class PatientAimBloodPressure extends IdEntity {
    private String sbpMin;
    private String sbpMin;
    private String dbpMin;
    private String dbpMin;
    private String unit;
    private String unit;
    private Timestamp createTime;
    private Date createTime;
    @Basic
    @Basic
    @Column(name = "code")
    @Column(name = "code")
@ -94,11 +96,12 @@ public class PatientAimBloodPressure extends IdEntity {
    @Basic
    @Basic
    @Column(name = "create_time")
    @Column(name = "create_time")
    public Timestamp getCreateTime() {
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
        return createTime;
    }
    }
    public void setCreateTime(Timestamp createTime) {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
        this.createTime = createTime;
    }
    }

+ 6 - 3
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/PatientAimBloodSugger.java

@ -1,9 +1,11 @@
package com.yihu.wlyy.entity.patient;
package com.yihu.wlyy.entity.patient;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.*;
import javax.persistence.*;
import java.sql.Timestamp;
import java.sql.Timestamp;
import java.util.Date;
/**
/**
 * 患者监测目标-血糖
 * 患者监测目标-血糖
@ -19,7 +21,7 @@ public class PatientAimBloodSugger extends IdEntity {
    private String hpg;
    private String hpg;
    private String minimum;
    private String minimum;
    private String unit;
    private String unit;
    private Timestamp createTime;
    private Date createTime;
    @Basic
    @Basic
    @Column(name = "code")
    @Column(name = "code")
@ -83,11 +85,12 @@ public class PatientAimBloodSugger extends IdEntity {
    @Basic
    @Basic
    @Column(name = "create_time")
    @Column(name = "create_time")
    public Timestamp getCreateTime() {
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
        return createTime;
    }
    }
    public void setCreateTime(Timestamp createTime) {
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
        this.createTime = createTime;
    }
    }

+ 9 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/TrackPatient.java

@ -20,6 +20,7 @@ public class TrackPatient extends IdEntity {
    private Integer teamCode;//居民签约团队
    private Integer teamCode;//居民签约团队
    private String idcard;//身份证号
    private String idcard;//身份证号
    private String ssc;//社保卡号
    private String ssc;//社保卡号
    private String del;//删除
    private Date createTime;//创建时间
    private Date createTime;//创建时间
    private Date updateTime;//更新时间
    private Date updateTime;//更新时间
@ -94,4 +95,12 @@ public class TrackPatient extends IdEntity {
    public void setUpdateTime(Date updateTime) {
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
        this.updateTime = updateTime;
    }
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}
}

+ 15 - 1
edu-article/JkEdu/WebRoot/WEB-INF/classes/Article.sql.xml

@ -8,6 +8,13 @@
		
		
			]]>
			]]>
		</Sql>
		</Sql>
		<!--<Sql name='getArticleList'>
			<![CDATA[
		select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.PushNumber,0) as CommentNumber, IFNULL(n.PushNumber,0) as PushNumber
		from Org_Article m JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 @Condition
			]]>
		</Sql>-->
		<Sql name='getArticleListCount'>
		<Sql name='getArticleListCount'>
			<![CDATA[
			<![CDATA[
	select count(*) from Org_Article m 
	select count(*) from Org_Article m 
@ -15,10 +22,17 @@ LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 @Conditi
			]]>
			]]>
		</Sql>
		</Sql>
		<Sql name='getCollectionArticleList'>
		<!--<Sql name='getCollectionArticleList'>
			<![CDATA[
			<![CDATA[
select aa.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber, IFNULL(n.PushNumber,0) as PushNumber from (
select aa.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber, IFNULL(n.PushNumber,0) as PushNumber from (
select m.* from Org_Article m  INNER JOIN User_ArticleCollection n on  m.articleid=n.ArticleId and  1=1 @UserParam) as aa LEFT JOIN 
select m.* from Org_Article m  INNER JOIN User_ArticleCollection n on  m.articleid=n.ArticleId and  1=1 @UserParam) as aa LEFT JOIN 
User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
			]]>
		</Sql>-->
		<Sql name='getCollectionArticleList'>
			<![CDATA[
select aa.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber, IFNULL(n.PushNumber,0) as PushNumber from (
select m.* from Org_Article m  INNER JOIN User_ArticleCollection n on  m.articleid=n.ArticleId and  1=1 @UserParam) as aa LEFT JOIN
User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
			]]>
			]]>
		</Sql>
		</Sql>

+ 8 - 1
edu-article/JkEdu/WebRoot/WEB-INF/classes/articlePc.sql.xml

@ -1,12 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<das-client>
<das-client>
	<Sqls> 
	<Sqls> 
		 <Sql name='getArticlePcList'>
		 <!--<Sql name='getArticlePcList'>
		 <![CDATA[
		 <![CDATA[
				select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber ,IFNULL(n.PushNumber,0) as PushNumber ,
				select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber ,IFNULL(n.PushNumber,0) as PushNumber ,
				(select count(1) from user_articlecollection a where a.ArticleId=m.ArticleId  @Condition2 )as collectionType, IFNULL(n.PushNumber,0) as PushNumber from Org_Article m
				(select count(1) from user_articlecollection a where a.ArticleId=m.ArticleId  @Condition2 )as collectionType, IFNULL(n.PushNumber,0) as PushNumber from Org_Article m
				LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1   and  ArticleState =1  @Condition    order by ArticleOrder desc  ,UpdateTime desc   @PageParam
				LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1   and  ArticleState =1  @Condition    order by ArticleOrder desc  ,UpdateTime desc   @PageParam
			]]>
			]]>
		</Sql>-->
		<Sql name='getArticlePcList'>
			<![CDATA[
				select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber ,IFNULL(n.PushNumber,0) as PushNumber ,
				(select count(1) from user_articlecollection a where a.ArticleId=m.ArticleId  @Condition2 )as collectionType, IFNULL(n.PushNumber,0) as PushNumber from Org_Article m
				LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1   and  ArticleState =1  @Condition    order by ArticleOrder desc  ,UpdateTime desc   @PageParam
			]]>
		</Sql>
		</Sql>
		<Sql name='getArticlePcListCount'>
		<Sql name='getArticlePcListCount'>
			<![CDATA[
			<![CDATA[

二进制
edu-article/JkEdu/WebRoot/WEB-INF/classes/com/yihu/jk/dao/ArticleDao.class


+ 24 - 10
edu-article/JkEdu/src/Article.sql.xml

@ -4,28 +4,42 @@
		<Sql name='getArticleList'>
		<Sql name='getArticleList'>
			<![CDATA[
			<![CDATA[
		select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber, IFNULL(n.PushNumber,0) as PushNumber
		select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber, IFNULL(n.PushNumber,0) as PushNumber
		from Org_Article m JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 @Condition
		from Org_Article m JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 and  m.ArticleState =1  @Condition
		
		
			]]>
			]]>
		</Sql>
		</Sql>
		<Sql name='getArticleListCount'>
		<Sql name='getArticleListCount'>
			<![CDATA[
			<![CDATA[
	select count(*) from Org_Article m 
	select count(*) from Org_Article m 
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 @Condition
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1 and  m.ArticleState =1  @Condition
			]]>
			]]>
		</Sql>
		</Sql>
		<Sql name='getCollectionArticleList'>
		<Sql name='getArticleById'>
			<![CDATA[
		select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber, IFNULL(n.PushNumber,0) as PushNumber
		from Org_Article m JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1   @Condition
			]]>
		</Sql>
		<!--<Sql name='getCollectionArticleList'>
			<![CDATA[
			<![CDATA[
select aa.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber, IFNULL(n.PushNumber,0) as PushNumber from (
select aa.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber, IFNULL(n.PushNumber,0) as PushNumber from (
select m.* from Org_Article m  INNER JOIN User_ArticleCollection n on  m.articleid=n.ArticleId and  1=1 @UserParam) as aa LEFT JOIN 
select m.* from Org_Article m  INNER JOIN User_ArticleCollection n on  m.articleid=n.ArticleId and  1=1 @UserParam) as aa LEFT JOIN 
User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
			]]>
		</Sql>-->
		<Sql name='getCollectionArticleList'>
			<![CDATA[
select aa.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber, IFNULL(n.PushNumber,0) as PushNumber from (
select m.* from Org_Article m  INNER JOIN User_ArticleCollection n on  m.articleid=n.ArticleId and  1=1 and  m.ArticleState =1  @UserParam) as aa LEFT JOIN
User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
			]]>
			]]>
		</Sql>
		</Sql>
		<Sql name='getCollectionArticleListCount'>
		<Sql name='getCollectionArticleListCount'>
			<![CDATA[
			<![CDATA[
select count(*) from (
select count(*) from (
select m.* from Org_Article m  INNER JOIN User_ArticleCollection n on  m.articleid=n.ArticleId and 1=1 @UserParam) as aa LEFT JOIN 
select m.* from Org_Article m  INNER JOIN User_ArticleCollection n on  m.articleid=n.ArticleId and 1=1 and  m.ArticleState =1  @UserParam) as aa LEFT JOIN
User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
User_ArticleStatistics n on aa.ArticleId=n.ArticleId where 1=1 @Condition
			]]>
			]]>
		</Sql>
		</Sql>
@ -105,10 +119,10 @@ FROM dual   where not exists( select ArticleId from User_ArticleStatistics where
				select * from (
				select * from (
		select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
		select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   m.isauthentication=1 and 1=1 @Condition
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   m.isauthentication=1 and 1=1 and  m.ArticleState =1  @Condition
		union
		union
		select m.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
		select m.* ,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   m.isauthentication=2 and  1=1 @Condition @Operatorid  
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   m.isauthentication=2 and  1=1 and  m.ArticleState =1  @Condition @Operatorid
	) as aa  @PageParam
	) as aa  @PageParam
		
		
			]]>
			]]>
@ -116,9 +130,9 @@ LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   m.isauthen
		<Sql name='getDoctorArticleListCount'>
		<Sql name='getDoctorArticleListCount'>
			<![CDATA[
			<![CDATA[
		select articleid from (
		select articleid from (
		select articleid from Org_Article where isauthentication=1  and 1=1  @Condition
		select articleid from Org_Article where isauthentication=1  and 1=1 and  m.ArticleState =1   @Condition
		union
		union
		select articleid from Org_Article where  isauthentication=2 and  1=1 @Condition @Operatorid  
		select articleid from Org_Article where  isauthentication=2 and  1=1 and  m.ArticleState =1  @Condition @Operatorid
		) as aa 
		) as aa 
			]]>
			]]>
@ -128,14 +142,14 @@ LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   m.isauthen
			<![CDATA[
			<![CDATA[
		select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
		select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   1=1 @Condition
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   1=1 and  m.ArticleState =1  @Condition
			]]>
			]]>
		</Sql>
		</Sql>
		<Sql name='getDoctorArticalByUserIdCount'>
		<Sql name='getDoctorArticalByUserIdCount'>
			<![CDATA[
			<![CDATA[
		select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
		select m.*,n.BrowseNumber,n.PointNumber,n.CollectionNumber,n.CommentNumber from Org_Article m 
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   1=1 @Condition 		 
LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where   1=1 and  m.ArticleState =1  @Condition
		
		
			]]>
			]]>
		</Sql>
		</Sql>

+ 3 - 3
edu-article/JkEdu/src/articlePc.sql.xml

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<das-client>
<das-client>
	<Sqls> 
	<Sqls> 
		 <Sql name='getArticlePcList'>
		 <![CDATA[
		<Sql name='getArticlePcList'>
			<![CDATA[
				select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber ,IFNULL(n.PushNumber,0) as PushNumber ,
				select m.*,IFNULL(n.BrowseNumber,0) as BrowseNumber,IFNULL(n.PointNumber,0) as PointNumber,IFNULL(n.CollectionNumber,0) as CollectionNumber,IFNULL(n.CommentNumber,0) as CommentNumber ,IFNULL(n.PushNumber,0) as PushNumber ,
				(select count(1) from user_articlecollection a where a.ArticleId=m.ArticleId  @Condition2 )as collectionType, IFNULL(n.PushNumber,0) as PushNumber from Org_Article m
				(select count(1) from user_articlecollection a where a.ArticleId=m.ArticleId  @Condition2 )as collectionType, IFNULL(n.PushNumber,0) as PushNumber from Org_Article m
				LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1   and  ArticleState =1  @Condition    order by ArticleOrder desc  ,UpdateTime desc   @PageParam
				LEFT JOIN User_ArticleStatistics n on m.ArticleId=n.ArticleId where 1=1   and  m.ArticleState =1  @Condition    order by ArticleOrder desc  ,UpdateTime desc   @PageParam
			]]>
			]]>
		</Sql>
		</Sql>
		<Sql name='getArticlePcListCount'>
		<Sql name='getArticlePcListCount'>

+ 10 - 0
edu-article/JkEdu/src/com/yihu/jk/action/ArticleAction.java

@ -20,6 +20,16 @@ public class ArticleAction {
	private ArticleDao dao = new ArticleDao();
	private ArticleDao dao = new ArticleDao();
	@RequestMapping("ArticleAction")
	@RequestMapping("ArticleAction")
	@ResponseBody
	@ResponseBody
	public String ArticleAction(HttpServletRequest request) {
	public String ArticleAction(HttpServletRequest request) {
		try {
		try {

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

@ -70,15 +70,15 @@ public class ArticleApiTest {
//		obj.put("articleTitle","我是");
//		obj.put("articleTitle","我是");
//		obj.put("userCode","0de7295862dd11e69faffa163e8aee56");
//		obj.put("userCode","0de7295862dd11e69faffa163e8aee56");
		obj.put("currentUserRole","350200");
		obj.put("currentUserRole","3502110400");
		obj.put("userCode","37959ddf86f211e6b394fa163e424525");//ylp201703150222
		obj.put("roleType",1);
		obj.put("userCode","b7f68412638e11e69616fa163e424525");//ylp201703150222
		//obj.put("roleType",1);
		obj.put("isMyArticle",true);
		obj.put("isMyArticle",true);
		obj.put("page","0");
		obj.put("page","0");
		obj.put("pageSize","9");
		obj.put("currentUserRoleLevel",2);//
		obj.put("sEcho","1");
		obj.put("pageSize","3");
		obj.put("currentUserRoleLevel",4);//
		//obj.put("sEcho","1");
//		obj.put("articleTitle","健管师");
//		obj.put("articleTitle","健管师");
		im.setParam(obj.toString());
		im.setParam(obj.toString());
		initDB();
		initDB();

+ 3 - 4
edu-article/JkEdu/src/com/yihu/jk/dao/ArticleDao.java

@ -199,13 +199,12 @@ public class ArticleDao {
	}
	}
	public List<ArticleStatistic> getArticleById(ArticleStatistic vo) throws SQLException {
	public List<ArticleStatistic> getArticleById(ArticleStatistic vo) throws SQLException {
		Sql sql = DB.me().createSql(ArticleSqlNameEnum.getArticleList);
		Sql sql = DB.me().createSql(ArticleSqlNameEnum.getArticleById);
		StringBuffer param = new StringBuffer();
		StringBuffer param = new StringBuffer();
		if (StringUtil.isNotEmpty(vo.getArticleId())) {
		if (StringUtil.isNotEmpty(vo.getArticleId())) {
			param.append(" and m.ArticleId = '").append(vo.getArticleId()).append("'");
			param.append(" and m.ArticleId = '").append(vo.getArticleId()).append("'");
		}
		}
		sql.addVar("@Condition", param.toString());
		sql.addVar("@Condition", param.toString());
		List<ArticleStatistic> list = DB.me().queryForBeanList(MyDatabaseEnum.JkEduDB, sql, ArticleStatistic.class);
		List<ArticleStatistic> list = DB.me().queryForBeanList(MyDatabaseEnum.JkEduDB, sql, ArticleStatistic.class);
		return list;
		return list;
@ -590,7 +589,7 @@ public class ArticleDao {
//			sql.addParamValue(Integer.valueOf(vo.getOperatorRoleLevel())-1);
//			sql.addParamValue(Integer.valueOf(vo.getOperatorRoleLevel())-1);
//			sql.addParamValue(vo.getOperatorRoleCode());
//			sql.addParamValue(vo.getOperatorRoleCode());
		}
		}
		param3.append(" or  ( OperatorId='"+userCode+"' and UserScope=4 "+(vo.getRoleType()!=null?" and RoleType = "+vo.getRoleType().intValue():"")+" and OperatorRoleCode = "+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())){//省
		if("1".equals(vo.getOperatorRoleLevel())){//省
//			param.append(" and OperatorRoleCode like '"+vo.getOperatorRoleCode().substring(0,3)+"%' ");
//			param.append(" and OperatorRoleCode like '"+vo.getOperatorRoleCode().substring(0,3)+"%' ");
		}else if("2".equals(vo.getOperatorRoleLevel())){//市
		}else if("2".equals(vo.getOperatorRoleLevel())){//市
@ -719,7 +718,7 @@ public class ArticleDao {
//			sql.addParamValue(Integer.valueOf(vo.getOperatorRoleLevel())-1);
//			sql.addParamValue(Integer.valueOf(vo.getOperatorRoleLevel())-1);
//			sql.addParamValue(vo.getOperatorRoleCode());
//			sql.addParamValue(vo.getOperatorRoleCode());
		}
		}
		param3.append(" or  ( OperatorId='"+userCode+"' and UserScope=4 "+(vo.getRoleType()!=null?" and RoleType = "+vo.getRoleType().intValue():"")+" and OperatorRoleCode = "+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())){//省
		if("1".equals(vo.getOperatorRoleLevel())){//省
//			param.append(" and OperatorRoleCode like '"+vo.getOperatorRoleCode().substring(0,3)+"%' ");
//			param.append(" and OperatorRoleCode like '"+vo.getOperatorRoleCode().substring(0,3)+"%' ");
		}else if("2".equals(vo.getOperatorRoleLevel())){//市
		}else if("2".equals(vo.getOperatorRoleLevel())){//市

+ 1 - 1
edu-article/JkEdu/src/com/yihu/jk/enums/ArticleSqlNameEnum.java

@ -7,5 +7,5 @@ public enum ArticleSqlNameEnum implements SqlNameEnum {
	getArticleList, getArticlePcList, queryCategory, getCollectionArticleList, loadAllConfigDictionary, getArticlePc, querySwitchState, pointNumberCount, collectionNumberCount, updateArticleStatistic, updateCollectionStatistic, updateCommentStatistic, insertArticleStatistic, deleteArticleStatistic, queryArticleStatistic, insertArticleInitStatistic
	getArticleList, getArticlePcList, queryCategory, getCollectionArticleList, loadAllConfigDictionary, getArticlePc, querySwitchState, pointNumberCount, collectionNumberCount, updateArticleStatistic, updateCollectionStatistic, updateCommentStatistic, insertArticleStatistic, deleteArticleStatistic, queryArticleStatistic, insertArticleInitStatistic
	, getArticlePcId, getDoctorArticleList, getDoctorArticleListCount, getDoctorArticalByUserIdCount, getDoctorArticalByUserId,getArticlePcListCount
	, getArticlePcId, getDoctorArticleList, getDoctorArticleListCount, getDoctorArticalByUserIdCount, getDoctorArticalByUserId,getArticlePcListCount
	,updateArticle
	,updateArticle,getArticleById
}
}

+ 2 - 1
edu-article/JkEdu/src/com/yihu/jk/vo/OrgArticleVo.java

@ -12,7 +12,7 @@ public class OrgArticleVo {
	private String ArticleTitle;//文章标题
	private String ArticleTitle;//文章标题
	private String ArticleContent;
	private String ArticleContent;
	private Integer ArticleOrder;// 文章排序
	private Integer ArticleOrder;// 文章排序
	private Integer ArticleState;
	private Integer ArticleState; //1、正常;2、删除
	private String OrgName;// 操作人所属机构
	private String OrgName;// 操作人所属机构
	private String ArticleSource;// 文章来源默认操作人所属机构
	private String ArticleSource;// 文章来源默认操作人所属机构
	private String OrgId;// 操作人所属机构
	private String OrgId;// 操作人所属机构
@ -45,6 +45,7 @@ public class OrgArticleVo {
	private String OperatorRoleLevel;//操作人角色级别
	private String OperatorRoleLevel;//操作人角色级别
	private Integer UserScope;//使用范围(1、全市使用,2、全区使用,3、全社区使用)
	private Integer UserScope;//使用范围(1、全市使用,2、全区使用,3、全社区使用)
	private Integer RoleType;//1、健管师,2、管理员
	private Integer RoleType;//1、健管师,2、管理员
	public String getFirstLevelCategoryName() {
	public String getFirstLevelCategoryName() {
		return FirstLevelCategoryName;
		return FirstLevelCategoryName;
	}
	}

+ 5 - 0
patient-co-service/wlyy_device/pom.xml

@ -145,6 +145,11 @@
            <artifactId>springfox-swagger-ui</artifactId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.4.0</version>
            <version>2.4.0</version>
        </dependency>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>patient-co-wlyy</artifactId>
            <version>1.0.0</version>
        </dependency>
    </dependencies>
    </dependencies>
    <build>
    <build>
        <plugins>
        <plugins>

+ 12 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/DoctorSwitchDao.java

@ -0,0 +1,12 @@
package com.yihu.hos.device.common.dao;
import com.yihu.hos.device.model.DoctorSwitch;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by Trick on 2018/1/8.
 */
public interface DoctorSwitchDao extends PagingAndSortingRepository<DoctorSwitch, Long>, JpaSpecificationExecutor<DoctorSwitch> {
    public DoctorSwitch findByDoctor(String doctor);
}

+ 17 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/common/dao/TrackPatientDao.java

@ -0,0 +1,17 @@
package com.yihu.hos.device.common.dao;
import com.yihu.hos.device.model.TrackPatient;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Trick on 2018/1/4.
 */
public interface TrackPatientDao extends PagingAndSortingRepository<TrackPatient, String>, JpaSpecificationExecutor<TrackPatient> {
    public TrackPatient findByDoctorCodeAndPatientCode(String doctorCode, String patientCode);
    public List<TrackPatient> findByDoctorCodeAndTeamCode(String doctorCode, Integer teamCode);
}

+ 50 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/DoctorSwitch.java

@ -0,0 +1,50 @@
package com.yihu.hos.device.model;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2018/1/4.
 */
@Entity
@Table(name = "wlyy_doctor_switch")
public class DoctorSwitch extends IdEntity{
    private String doctor;//关联医生
    private String alertPatientSwitch;//0不自动跟踪居民,1自动跟踪预警居民
    private Date createTime;//创建时间
    private Date updateTime;//更新时间
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getAlertPatientSwitch() {
        return alertPatientSwitch;
    }
    public void setAlertPatientSwitch(String alertPatientSwitch) {
        this.alertPatientSwitch = alertPatientSwitch;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 104 - 0
patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/model/TrackPatient.java

@ -0,0 +1,104 @@
package com.yihu.hos.device.model;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by Trick on 2018/1/4.
 */
@Entity
@Table(name = "wlyy_track_patient")
public class TrackPatient extends IdEntity {
    private String patientCode;//关联居民code,医生的重点关注对象
    private String patientName;//患者姓名
    private String doctorCode;//所属医生
    private String doctorName;//所属医生名
    private Integer teamCode;//居民签约团队
    private String idcard;//身份证号
    private String ssc;//社保卡号
    private String del;//1正常,0删除
    private Date createTime;//创建时间
    private Date updateTime;//更新时间
    public String getPatientCode() {
        return patientCode;
    }
    public void setPatientCode(String patientCode) {
        this.patientCode = patientCode;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getDoctorCode() {
        return doctorCode;
    }
    public void setDoctorCode(String doctorCode) {
        this.doctorCode = doctorCode;
    }
    public String getDoctorName() {
        return doctorName;
    }
    public void setDoctorName(String doctorName) {
        this.doctorName = doctorName;
    }
    public Integer getTeamCode() {
        return teamCode;
    }
    public void setTeamCode(Integer teamCode) {
        this.teamCode = teamCode;
    }
    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 Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public String getDel() {
        return del;
    }
    public void setDel(String del) {
        this.del = del;
    }
}

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

@ -69,6 +69,10 @@ public class DeviceService {
    private ImUtill ImUtill;
    private ImUtill ImUtill;
    @Autowired
    @Autowired
    private MessageService messageService;
    private MessageService messageService;
    @Autowired
    private DoctorSwitchDao doctorSwitchDao;
    @Autowired
    private TrackPatientDao trackPatientDao;
    @Value("${systemConfig.server_url}")
    @Value("${systemConfig.server_url}")
    private String wlyyService;
    private String wlyyService;
@ -514,6 +518,8 @@ public class DeviceService {
            //连续3次异常,修改用户为预警状态
            //连续3次异常,修改用户为预警状态
            if( (bloodPressureBbnormalCount >=3 || bloodSuggurBbnormalCount >=3) && (patient.getStandardStatus() == null || 0 == patient.getStandardStatus())){
            if( (bloodPressureBbnormalCount >=3 || bloodSuggurBbnormalCount >=3) && (patient.getStandardStatus() == null || 0 == patient.getStandardStatus())){
                patient.setStandardStatus(1);
                patient.setStandardStatus(1);
                //1.4.2加入重点关注逻辑
                setTrackPatientByDoctor(patientCode);
            }else{
            }else{
                Date end = new Date();
                Date end = new Date();
                Date start = DateUtil.setDateTime(end,-7);
                Date start = DateUtil.setDateTime(end,-7);
@ -521,6 +527,8 @@ public class DeviceService {
                int errorCount = patientHealthIndexDao.getCountByTimeAndStatus(start,end,1,patientCode);
                int errorCount = patientHealthIndexDao.getCountByTimeAndStatus(start,end,1,patientCode);
                if(errorCount >= 5){//超过5次,记为预警状态
                if(errorCount >= 5){//超过5次,记为预警状态
                    patient.setStandardStatus(1);
                    patient.setStandardStatus(1);
                    //1.4.2加入重点关注逻辑
                    setTrackPatientByDoctor(patientCode);
                }
                }
            }
            }
@ -529,18 +537,26 @@ public class DeviceService {
                if("1".equals(patientdisease)){
                if("1".equals(patientdisease)){
                    if(0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                    if(0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                        patient.setStandardStatus(0);
                        patient.setStandardStatus(0);
                        //1.4.2加入重点关注逻辑
                        cancalTrackPatientByDoctor(patientCode);
                    }
                    }
                }else if("2".equals(patientdisease)){
                }else if("2".equals(patientdisease)){
                    if(0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                    if(0 == bloodSuggurBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                        patient.setStandardStatus(0);
                        patient.setStandardStatus(0);
                        //1.4.2加入重点关注逻辑
                        cancalTrackPatientByDoctor(patientCode);
                    }
                    }
                }else if( "1,2".equals(patientdisease) || "2,1".equals(patientdisease)){
                }else if( "1,2".equals(patientdisease) || "2,1".equals(patientdisease)){
                    if( 0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                    if( 0 == bloodSuggurBbnormalCount && 0 == bloodPressureBbnormalCount && (patient.getStandardStatus() == null || 1 == patient.getStandardStatus())){
                        patient.setStandardStatus(0);
                        patient.setStandardStatus(0);
                        //1.4.2加入重点关注逻辑
                        cancalTrackPatientByDoctor(patientCode);
                    }
                    }
                }
                }
            }else{
            }else{
                patient.setStandardStatus(0);
                patient.setStandardStatus(0);
                //1.4.2加入重点关注逻辑
                cancalTrackPatientByDoctor(patientCode);
            }
            }
            patientDao.save(patient);
            patientDao.save(patient);
@ -550,7 +566,134 @@ public class DeviceService {
        }
        }
    }
    }
    
    /**
     * 设置
     * @param patient
     * @return
     */
    public int setTrackPatientByDoctor(String patient){
        SignFamily signFamily = signFamilyDao.findByjiatingPatientYes(patient);
        if(signFamily==null){
            return -1;
        }
        Patient p = patientDao.findByCode(patient);
        if(p==null){
            return -1;
        }
        //医生是否自动追踪居民
        DoctorSwitch sw =  doctorSwitchDao.findByDoctor(signFamily.getDoctor());
        DoctorSwitch swh =  doctorSwitchDao.findByDoctor(signFamily.getDoctorHealth());
        if(sw!=null){
            if("1".equals(sw.getAlertPatientSwitch())){
                //查询是否与医生建立重点跟踪关系,诺无关系则建立
                TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(signFamily.getDoctor(),patient);
                if(trackPatient == null){
                    TrackPatient t = new TrackPatient();
                    t.setCreateTime(new Date());
                    t.setDoctorCode(signFamily.getDoctor());
                    t.setDoctorName(signFamily.getDoctorName());
                    t.setIdcard(signFamily.getIdcard());
                    t.setSsc(signFamily.getSsc());
                    t.setTeamCode(signFamily.getAdminTeamId().intValue());
                    t.setPatientCode(patient);
                    t.setPatientName(p.getName());
                    t.setDel("1");
                    trackPatientDao.save(t);
                }else{
                    trackPatient.setDel("1");
                    trackPatientDao.save(trackPatient);
                }
            }
        }
        if(swh!=null){
            if("1".equals(sw.getAlertPatientSwitch())){
                //查询是否与医生建立重点跟踪关系,诺无关系则建立
                TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(signFamily.getDoctorHealth(),patient);
                if(trackPatient == null){
                    TrackPatient t = new TrackPatient();
                    t.setCreateTime(new Date());
                    t.setDoctorCode(signFamily.getDoctorHealth());
                    t.setDoctorName(signFamily.getDoctorHealthName());
                    t.setIdcard(signFamily.getIdcard());
                    t.setSsc(signFamily.getSsc());
                    t.setTeamCode(signFamily.getAdminTeamId().intValue());
                    t.setPatientCode(patient);
                    t.setPatientName(p.getName());
                    t.setDel("1");
                    trackPatientDao.save(t);
                }else{
                    trackPatient.setDel("1");
                    trackPatientDao.save(trackPatient);
                }
            }
        }
        return 1;
    }
    public int cancalTrackPatientByDoctor(String patient){
        SignFamily signFamily = signFamilyDao.findByjiatingPatientYes(patient);
        if(signFamily==null){
            return -1;
        }
        Patient p = patientDao.findByCode(patient);
        if(p==null){
            return -1;
        }
        //医生是否自动追踪居民
        DoctorSwitch sw =  doctorSwitchDao.findByDoctor(signFamily.getDoctor());
        DoctorSwitch swh =  doctorSwitchDao.findByDoctor(signFamily.getDoctorHealth());
        if(sw!=null){
            if("1".equals(sw.getAlertPatientSwitch())){
                //查询是否与医生建立重点跟踪关系,诺无关系则建立
                TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(signFamily.getDoctor(),patient);
                if(trackPatient == null){
                    TrackPatient t = new TrackPatient();
                    t.setCreateTime(new Date());
                    t.setDoctorCode(signFamily.getDoctor());
                    t.setDoctorName(signFamily.getDoctorName());
                    t.setIdcard(signFamily.getIdcard());
                    t.setSsc(signFamily.getSsc());
                    t.setTeamCode(signFamily.getAdminTeamId().intValue());
                    t.setPatientCode(patient);
                    t.setPatientName(p.getName());
                    t.setDel("0");
                    trackPatientDao.save(t);
                }else{
                    trackPatient.setDel("0");
                    trackPatientDao.save(trackPatient);
                }
            }
        }
        if(swh!=null){
            if("1".equals(sw.getAlertPatientSwitch())){
                //查询是否与医生建立重点跟踪关系,诺无关系则建立
                TrackPatient trackPatient = trackPatientDao.findByDoctorCodeAndPatientCode(signFamily.getDoctorHealth(),patient);
                if(trackPatient == null){
                    TrackPatient t = new TrackPatient();
                    t.setCreateTime(new Date());
                    t.setDoctorCode(signFamily.getDoctorHealth());
                    t.setDoctorName(signFamily.getDoctorHealthName());
                    t.setIdcard(signFamily.getIdcard());
                    t.setSsc(signFamily.getSsc());
                    t.setTeamCode(signFamily.getAdminTeamId().intValue());
                    t.setPatientCode(patient);
                    t.setPatientName(p.getName());
                    t.setDel("0");
                    trackPatientDao.save(t);
                }else{
                    trackPatient.setDel("0");
                    trackPatientDao.save(trackPatient);
                }
            }
        }
        return 1;
    }
    /**
    /**
     * 保存设备数据
     * 保存设备数据
     */
     */

文件差异内容过多而无法显示
+ 1 - 1
patient-co-service/wlyy_service/src/main/java/com/yihu/wlyy/service/controller/PrescriptionController.java


+ 167 - 0
patient-co/patient-co-wlyy/doc/技术文档/es/健教文章新增索引.txt

@ -0,0 +1,167 @@
创建索引
POST  http://172.19.103.68:9200/health_edu_article_patient_test
查询索引
GET http://172.19.103.68:9200/health_edu_article_patient_test/
给索引加mapping
POST http://172.19.103.68:9200/health_edu_article_patient_test/health_edu_article_patient_test/_mapping
{
    "health_edu_article_patient": {
        "properties": {
            "currentUserRoleCode": {
                "index": "not_analyzed",
                "type": "string"
            },
            "isRead": {
                "type": "integer"
            },
            "allCount": {
                "type": "integer"
            },
            "articleCover": {
                "index": "not_analyzed",
                "type": "string"
            },
            "doctorName": {
                "index": "not_analyzed",
                "type": "string"
            },
            "adminTeamCode": {
                "type": "long"
            },
            "articleContent": {
                "index": "not_analyzed",
                "type": "string"
            },
            "sendLevel": {
                "index": "not_analyzed",
                "type": "string"
            },
            "id": {
                "type": "string"
            },
            "hospital": {
                "index": "not_analyzed",
                "type": "string"
            },
            "operatorId": {
                "index": "not_analyzed",
                "type": "string"
            },
            "secondLevelCategoryName": {
                "index": "not_analyzed",
                "type": "string"
            },
            "patientCode": {
                "index": "not_analyzed",
                "type": "string"
            },
            "sendPic": {
                "index": "not_analyzed",
                "type": "string"
            },
            "sendSource": {
                "type": "integer"
            },
            "patientName": {
                "index": "not_analyzed",
                "type": "string"
            },
            "articleTitle": {
                "index": "not_analyzed",
                "type": "string"
            },
            "batchNo": {
                "index": "not_analyzed",
                "type": "string"
            },
            "currentUserRoleLevel": {
                "index": "not_analyzed",
                "type": "string"
            },
            "firstLevelCategoryId": {
                "index": "not_analyzed",
                "type": "string"
            },
            "townName": {
                "index": "not_analyzed",
                "type": "string"
            },
            "adminTeamName": {
                "index": "not_analyzed",
                "type": "string"
            },
            "sendName": {
                "index": "not_analyzed",
                "type": "string"
            },
            "town": {
                "index": "not_analyzed",
                "type": "string"
            },
            "articleId": {
                "index": "not_analyzed",
                "type": "string"
            },
            "articleCategoryId": {
                "index": "not_analyzed",
                "type": "string"
            },
            "secondLevelCategoryId": {
                "index": "not_analyzed",
                "type": "string"
            },
            "hospitalName": {
                "index": "not_analyzed",
                "type": "string"
            },
            "roleList": {
                "type": "nested",
                "properties": {
                    "code": {
                        "index": "not_analyzed",
                        "type": "string"
                    },
                    "name": {
                        "index": "not_analyzed",
                        "type": "string"
                    }
                }
            },
            "firstLevelCategoryName": {
                "index": "not_analyzed",
                "type": "string"
            },
            "articleSource": {
                "index": "not_analyzed",
                "type": "string"
            },
            "createTime": {
                "format": "strict_date_optional_time||epoch_millis",
                "type": "date"
            },
            "czrq": {
                "format": "strict_date_optional_time||epoch_millis",
                "type": "date"
            },
            "leaveWords": {
                "index": "not_analyzed",
                "type": "string"
            },
            "doctorCode": {
                "index": "not_analyzed",
                "type": "string"
            },
            "sendType": {
                "type": "integer"
            },
            "userType": {
                "type": "integer"
            },
            "sendSex": {
                "index": "not_analyzed",
                "type": "string"
            }
        }
    }
  }

+ 35 - 10
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java

@ -251,10 +251,9 @@ public class SignPatientLabelInfoService extends BaseService {
        //1.4.2 是否追踪居民健康体征
        //1.4.2 是否追踪居民健康体征
        if(StringUtils.isNotBlank(doctor)){
        if(StringUtils.isNotBlank(doctor)){
            String trackSql = "SELECT t.id FROM wlyy_track_patient t WHERE t,patient_code = '"+patient+"' AND t.doctor_code ='"+doctor+"'";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(trackSql);
            if(list!=null&&list.size()>0){
                json.put("isTrack","1");
            TrackPatient tp = trackPatientDao.findByDoctorCodeAndPatientCode(doctor,patient);
            if(tp!=null){
                json.put("isTrack",tp.getDel());
            }else{
            }else{
                json.put("isTrack","0");
                json.put("isTrack","0");
            }
            }
@ -262,10 +261,11 @@ public class SignPatientLabelInfoService extends BaseService {
        return json;
        return json;
    }
    }
    public String setTrackPatient(String patient,String doctor){
    public String setTrackPatient(String patient,String doctor,String state){
        TrackPatient tp  = trackPatientDao.findByDoctorCodeAndPatientCode(doctor,patient);
        TrackPatient tp  = trackPatientDao.findByDoctorCodeAndPatientCode(doctor,patient);
        if(tp!=null){
        if(tp!=null){
            trackPatientDao.delete(tp);
            tp.setDel(state);
            trackPatientDao.save(tp);
        }else{
        }else{
            Doctor d = doctorDao.findByCode(doctor);
            Doctor d = doctorDao.findByCode(doctor);
            Patient p = patientDao.findByCode(patient);
            Patient p = patientDao.findByCode(patient);
@ -277,6 +277,7 @@ public class SignPatientLabelInfoService extends BaseService {
            tkp.setPatientName(p.getName());
            tkp.setPatientName(p.getName());
            tkp.setSsc(p.getSsc());
            tkp.setSsc(p.getSsc());
            tkp.setIdcard(p.getIdcard());
            tkp.setIdcard(p.getIdcard());
            tkp.setDel(state);
            String signSql = "SELECT f.admin_team_code FROM wlyy_sign_family f WHERE (f.doctor = '"+doctor+"' OR f.doctor_health ='"+doctor+"') AND f.patient = '"+patient+"' AND f.status >0 ";
            String signSql = "SELECT f.admin_team_code FROM wlyy_sign_family f WHERE (f.doctor = '"+doctor+"' OR f.doctor_health ='"+doctor+"') AND f.patient = '"+patient+"' AND f.status >0 ";
            List<Map<String,Object>> list = jdbcTemplate.queryForList(signSql);
            List<Map<String,Object>> list = jdbcTemplate.queryForList(signSql);
            if(list!=null&&list.size()>0){
            if(list!=null&&list.size()>0){
@ -286,9 +287,19 @@ public class SignPatientLabelInfoService extends BaseService {
            }else{
            }else{
                return "-1";
                return "-1";
            }
            }
            trackPatientDao.save(tkp);
        }
        }
        return "1";
        return "1";
    }
    }
    public String getTrackFlag(String patient,String doctor){
        TrackPatient tp  = trackPatientDao.findByDoctorCodeAndPatientCode(doctor,patient);
        if(tp!=null){
            return  tp.getDel();
        }else{
            return "0";
        }
    }
    /**
    /**
     * 根据标签查询患者信息
     * 根据标签查询患者信息
     *
     *
@ -303,7 +314,7 @@ public class SignPatientLabelInfoService extends BaseService {
     */
     */
    public JSONArray getPatientByLabel(String doctor, String labelCode, String labelType,
    public JSONArray getPatientByLabel(String doctor, String labelCode, String labelType,
                                       Long teamCode, int page, int pagesize, boolean isSlowDisease,
                                       Long teamCode, int page, int pagesize, boolean isSlowDisease,
                                       String diseaseCondition,boolean isFollowWeChat) throws Exception {
                                       String diseaseCondition,boolean isFollowWeChat,String trackFlag) throws Exception {
        Doctor doc = doctorDao.findByCode(doctor);
        Doctor doc = doctorDao.findByCode(doctor);
        if (doc == null) {
        if (doc == null) {
@ -384,6 +395,9 @@ public class SignPatientLabelInfoService extends BaseService {
                    "  FROM  wlyy_sign_family t1 " +
                    "  FROM  wlyy_sign_family t1 " +
                    "  LEFT JOIN wlyy_patient p on p.code = t1.patient  "+
                    "  LEFT JOIN wlyy_patient p on p.code = t1.patient  "+
                    "  RIGHT JOIN wlyy_sign_patient_label_info t2 on t2.patient = t1.patient ";
                    "  RIGHT JOIN wlyy_sign_patient_label_info t2 on t2.patient = t1.patient ";
            if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
                sql = sql +" JOIN wlyy_track_patient tp WHERE tp.patient_code = p.code";
            }
            sql = sql + " WHERE t2.label = ?";
            sql = sql + " WHERE t2.label = ?";
            if(StringUtils.isNotBlank(diseaseCondition)) {
            if(StringUtils.isNotBlank(diseaseCondition)) {
@ -400,6 +414,9 @@ public class SignPatientLabelInfoService extends BaseService {
            if(isFollowWeChat){
            if(isFollowWeChat){
                sql += "  AND p.openid IS NOT NULL AND p.openid <>'' ";
                sql += "  AND p.openid IS NOT NULL AND p.openid <>'' ";
            }
            }
            if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
                sql = sql + " AND tp.del='1'  AND tp.doctor_code ='"+doctor+"' AND tp.team_code"+teamCode;
            }
    
    
            sql = sql + " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) ";
            sql = sql + " order by p.standard_status DESC ,p.disease_condition DESC,t2.label DESC,t1.openid DESC ,convert(t1.name using gbk) ";
            if(StringUtils.isNotBlank(diseaseCondition)) {
            if(StringUtils.isNotBlank(diseaseCondition)) {
@ -1099,7 +1116,7 @@ public class SignPatientLabelInfoService extends BaseService {
     * @param teamCode  标签类型为4时,不能为空
     * @param teamCode  标签类型为4时,不能为空
     * @return
     * @return
     */
     */
    public JSONArray getPatientAmountByLabelType(String doctor, String labelType, Long teamCode, boolean isSlowDisease, String diseaseCondition) throws Exception {
    public JSONArray getPatientAmountByLabelType(String doctor, String labelType, Long teamCode, boolean isSlowDisease, String diseaseCondition,String trackFlag) throws Exception {
        Doctor doc = doctorDao.findByCode(doctor);
        Doctor doc = doctorDao.findByCode(doctor);
        if (doc == null) {
        if (doc == null) {
@ -1177,8 +1194,12 @@ public class SignPatientLabelInfoService extends BaseService {
                                "     count(DISTINCT t1.patient) count" +
                                "     count(DISTINCT t1.patient) count" +
                                " FROM wlyy_sign_family t1 " +
                                " FROM wlyy_sign_family t1 " +
                                " RIGHT JOIN wlyy_sign_patient_label_info t2 ON t1.patient = t2.patient and t2.status=1 " +
                                " RIGHT JOIN wlyy_sign_patient_label_info t2 ON t1.patient = t2.patient and t2.status=1 " +
                                " JOIN wlyy_patient t3 ON t1.patient = t3.code " +
                                " WHERE" +
                                " JOIN wlyy_patient t3 ON t1.patient = t3.code " ;
                                //1.4.2新增重点居民跟踪过滤
                                if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
                                     sql = sql +" JOIN wlyy_track_patient tp ON tp.patient_code = t3.code";
                                }
                        sql = sql +" WHERE" +
                                "     t1.patient = t2.patient " +
                                "     t1.patient = t2.patient " +
                                "     AND t1.patient = t3.code "+
                                "     AND t1.patient = t3.code "+
                                "     AND t2.label = ? " +
                                "     AND t2.label = ? " +
@ -1188,6 +1209,10 @@ public class SignPatientLabelInfoService extends BaseService {
                                "     AND t1.status > 0 " +
                                "     AND t1.status > 0 " +
                                (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "")+
                                (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "")+
                                "     AND t3.disease_condition = ? ";
                                "     AND t3.disease_condition = ? ";
                                //1.4.2新增重点居民跟踪过滤
                                if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
                                    sql = sql + " AND tp.del='1' AND tp.doctor_code='"+doctor+"' AND tp.team_code ="+teamCode;
                                }
                        if (teamCode > 0) {
                        if (teamCode > 0) {
                            args = new Object[]{label.getLabelCode(), labelType, doctor, doctor, teamCode,diseaseCondition};
                            args = new Object[]{label.getLabelCode(), labelType, doctor, doctor, teamCode,diseaseCondition};

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

@ -17,9 +17,11 @@ import com.yihu.wlyy.repository.doctor.*;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.repository.patient.TrackPatientDao;
import com.yihu.wlyy.repository.patient.TrackPatientDao;
import com.yihu.wlyy.repository.patient.scheme.PatientSchemeListDao;
import com.yihu.wlyy.repository.patient.scheme.PatientSchemeListDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.DateUtil;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.util.StringUtil;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -41,7 +43,7 @@ import java.util.*;
 * @date 2017/9/13 15:46
 * @date 2017/9/13 15:46
 */
 */
@Service
@Service
public class DoctorSchemeService {
public class DoctorSchemeService extends BaseService{
    private static Logger logger = LoggerFactory.getLogger(DoctorSchemeService.class);
    private static Logger logger = LoggerFactory.getLogger(DoctorSchemeService.class);
    @Autowired
    @Autowired
@ -91,10 +93,15 @@ public class DoctorSchemeService {
     * @date 2017/9/13 16:23
     * @date 2017/9/13 16:23
     * @return
     * @return
     */
     */
    public List<String> getPatientsByDiseaseConditionDiseaseDeviceType(String teamCode, Integer disease, String diseaseCondition, Integer deviceType,String doctorcode) throws Exception{
    public List<String> getPatientsByDiseaseConditionDiseaseDeviceType(String teamCode, Integer disease, String diseaseCondition, Integer deviceType,String doctorcode,String trackFlag) throws Exception{
        String sql = "select DISTINCT p.code from wlyy_patient p ";
        String sql = "select DISTINCT p.code from wlyy_patient p ";
        //1.4.2加入跟踪居民过滤
        if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
            sql = sql + " JOIN wlyy_track_patient tp ON tp.patientCode = p.code ";
        }
        if(-1 != deviceType){
        if(-1 != deviceType){
            sql = sql + " LEFT JOIN wlyy_patient_device dev on dev.user = p.code ";
            sql = sql + " LEFT JOIN wlyy_patient_device dev on dev.user = p.code ";
        }
        }
@ -127,6 +134,12 @@ public class DoctorSchemeService {
        sql = sql + " and p.status > 0 and sp.label_type = 3 and sf.status > 0 ";
        sql = sql + " and p.status > 0 and sp.label_type = 3 and sf.status > 0 ";
        //1.4.2加入跟踪居民过滤
        if(StringUtils.isNotBlank(trackFlag)&&"1".equals(trackFlag)){
            sql = sql + "pt.del='1' AND pt.doctor_code = '"+doctorcode+"' AND pt.teamCode = "+teamCode;
        }
        List<String> result = jdbcTemplate.queryForList(sql,new Object[]{},String.class);
        List<String> result = jdbcTemplate.queryForList(sql,new Object[]{},String.class);
@ -779,7 +792,7 @@ public class DoctorSchemeService {
                " AND i.value1 > 6.1 " +
                " AND i.value1 > 6.1 " +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " ) bf, " +
                " ) bf, " +
                " (  " +
                " (  " +
                " SELECT " +
                " SELECT " +
@ -793,7 +806,7 @@ public class DoctorSchemeService {
                " AND i.value1 > 7.8 " +
                " AND i.value1 > 7.8 " +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " ) aft";
                " ) aft";
        String stdSql ="SELECT  " +
        String stdSql ="SELECT  " +
                " (bf.befHighCount + aft.aftHighCount) AS stdCount " +
                " (bf.befHighCount + aft.aftHighCount) AS stdCount " +
@ -811,7 +824,7 @@ public class DoctorSchemeService {
                " AND i.value1 >= 3.9 " +
                " AND i.value1 >= 3.9 " +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " ) bf, " +
                " ) bf, " +
                " (  " +
                " (  " +
                " SELECT " +
                " SELECT " +
@ -826,7 +839,7 @@ public class DoctorSchemeService {
                " AND i.value1 >= 4.4 " +
                " AND i.value1 >= 4.4 " +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " ) aft";
                " ) aft";
        String lowSql ="SELECT  " +
        String lowSql ="SELECT  " +
                " (bf.befHighCount + aft.aftHighCount) AS lowCount " +
                " (bf.befHighCount + aft.aftHighCount) AS lowCount " +
@ -843,7 +856,7 @@ public class DoctorSchemeService {
                " AND i.value1 <= 3.9 " +
                " AND i.value1 <= 3.9 " +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " ) bf, " +
                " ) bf, " +
                " (  " +
                " (  " +
                " SELECT " +
                " SELECT " +
@ -857,7 +870,7 @@ public class DoctorSchemeService {
                " AND i.value1 <= 4.4 " +
                " AND i.value1 <= 4.4 " +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")" +
                " ) aft";
                " ) aft";
        String pHighSql ="SELECT " +
        String pHighSql ="SELECT " +
@ -870,7 +883,7 @@ public class DoctorSchemeService {
                " AND i.value1 >= 139 " +
                " AND i.value1 >= 139 " +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
        String  pStdSql ="SELECT " +
        String  pStdSql ="SELECT " +
                " count(1) AS stdCount " +
                " count(1) AS stdCount " +
                " FROM " +
                " FROM " +
@ -882,7 +895,7 @@ public class DoctorSchemeService {
                " AND i.value1 >= 90 " +
                " AND i.value1 >= 90 " +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
        String pLowSql ="SELECT " +
        String pLowSql ="SELECT " +
                " count(1) AS lowCount " +
                " count(1) AS lowCount " +
                " FROM " +
                " FROM " +
@ -893,7 +906,7 @@ public class DoctorSchemeService {
                " AND i.value1 <= 90 " +
                " AND i.value1 <= 90 " +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date >='"+startDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.record_date <='"+endDate+"'" +
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
                " AND i.user IN (SELECT t.patient_code FROM wlyy.wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +teamCode+")";
        Map<String,Object> rs = new HashedMap();
        Map<String,Object> rs = new HashedMap();
        //0血檀
        //0血檀
@ -1061,7 +1074,8 @@ public class DoctorSchemeService {
                " FROM " +
                " FROM " +
                " wlyy_track_patient t " +
                " wlyy_track_patient t " +
                " WHERE " +
                " WHERE " +
                " t.doctor_code = '"+doctor+"' " +
                " t.del='1' " +
                " AND t.doctor_code = '"+doctor+"' " +
                " AND t.team_code = '"+teamCode+"' " +
                " AND t.team_code = '"+teamCode+"' " +
                " AND t.create_time >= '"+startDate+"' " +
                " AND t.create_time >= '"+startDate+"' " +
                " AND t.create_time <= '"+endDate+"'";
                " AND t.create_time <= '"+endDate+"'";
@ -1127,7 +1141,7 @@ public class DoctorSchemeService {
                " AND t.create_time >= '" + startDate + "' " +
                " AND t.create_time >= '" + startDate + "' " +
                " AND t.create_time <= '" + endDate + "'" +
                " AND t.create_time <= '" + endDate + "'" +
                " AND c.patient IN(" +
                " AND c.patient IN(" +
                "  SELECT t.patient_code FROM wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +id+
                "  SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+
                " )" +
                " )" +
                " )c ON c.id = m.doctor_code " +
                " )c ON c.id = m.doctor_code " +
                " WHERE " +
                " WHERE " +
@ -1144,7 +1158,7 @@ public class DoctorSchemeService {
    public Long getReservationByteam(Long id,String doctor, String startDate, String endDate) {
    public Long getReservationByteam(Long id,String doctor, String startDate, String endDate) {
        //获取待预约
        //获取待预约
        String reservation_sql = "SELECT COUNT(1) AS reservationCount FROM wlyy_patient_reservation  w WHERE w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "' " +
        String reservation_sql = "SELECT COUNT(1) AS reservationCount FROM wlyy_patient_reservation  w WHERE w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "' " +
                " AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
                " AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
        //获取待预约
        //获取待预约
        Map<String, Object> reservationCout = jdbcTemplate.queryForMap(reservation_sql);
        Map<String, Object> reservationCout = jdbcTemplate.queryForMap(reservation_sql);
        if (reservationCout.get("reservationCount") == null) {
        if (reservationCout.get("reservationCount") == null) {
@ -1156,7 +1170,7 @@ public class DoctorSchemeService {
    public Long getEduArticleByTeam(Long id,String doctor, String startDate, String endDate) {
    public Long getEduArticleByTeam(Long id,String doctor, String startDate, String endDate) {
        //获取健康教育
        //获取健康教育
        String article_sql = "SELECT COUNT(1) AS articleCount FROM wlyy_health_edu_article_patient w WHERE  w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "'" +
        String article_sql = "SELECT COUNT(1) AS articleCount FROM wlyy_health_edu_article_patient w WHERE  w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "'" +
                " AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
                " AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
        //获取健康教育
        //获取健康教育
        Map<String, Object> articleCout = jdbcTemplate.queryForMap(article_sql);
        Map<String, Object> articleCout = jdbcTemplate.queryForMap(article_sql);
        if (articleCout.get("articleCount") == null) {
        if (articleCout.get("articleCount") == null) {
@ -1168,7 +1182,7 @@ public class DoctorSchemeService {
    public Long getGuidanceByTeam(Long id,String doctor, String startDate, String endDate) {
    public Long getGuidanceByTeam(Long id,String doctor, String startDate, String endDate) {
        //获取健康指导
        //获取健康指导
        String guidance_sql = "SELECT COUNT(1) AS guidanceCount  FROM wlyy_patient_health_guidance w WHERE w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "' " +
        String guidance_sql = "SELECT COUNT(1) AS guidanceCount  FROM wlyy_patient_health_guidance w WHERE w.admin_team_code =" + id + " AND w.czrq <='" + endDate + "' AND w.czrq >='" + startDate + "' " +
                " AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
                " AND w.doctor ='"+doctor+"' AND w.patient IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
        //获取健康指导
        //获取健康指导
        Map<String, Object> guidanceCout = jdbcTemplate.queryForMap(guidance_sql);
        Map<String, Object> guidanceCout = jdbcTemplate.queryForMap(guidance_sql);
        if (guidanceCout.get("guidanceCount") == null) {
        if (guidanceCout.get("guidanceCount") == null) {
@ -1181,7 +1195,7 @@ public class DoctorSchemeService {
    public Long getFollowByTeam(Long id,String doctor, String startDate, String endDate) {
    public Long getFollowByTeam(Long id,String doctor, String startDate, String endDate) {
        //随访数目
        //随访数目
        String followup_sql = "SELECT COUNT(1) AS followupCount from wlyy_followup w WHERE w.admin_team_code=" + id + " AND  w.create_time >='" + startDate + "' AND w.create_time<='" + endDate + "' " +
        String followup_sql = "SELECT COUNT(1) AS followupCount from wlyy_followup w WHERE w.admin_team_code=" + id + " AND  w.create_time >='" + startDate + "' AND w.create_time<='" + endDate + "' " +
                " AND w.doctor_code ='"+doctor+"' AND w.patient_code IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
                " AND w.doctor_code ='"+doctor+"' AND w.patient_code IN (SELECT t.patient_code FROM wlyy_track_patient t WHERE t.del='1' AND t.doctor_code ='"+doctor+"' AND t.team_code = " +id+") ";
        //随访数目
        //随访数目
        Map<String, Object> followupCout = jdbcTemplate.queryForMap(followup_sql);
        Map<String, Object> followupCout = jdbcTemplate.queryForMap(followup_sql);
        if (followupCout.get("followupCount") == null) {
        if (followupCout.get("followupCount") == null) {
@ -1204,7 +1218,7 @@ public class DoctorSchemeService {
                " AND p.patient IN ( " +
                " AND p.patient IN ( " +
                " SELECT t.patient_code " +
                " SELECT t.patient_code " +
                " FROM wlyy_track_patient t " +
                " FROM wlyy_track_patient t " +
                " WHERE t.doctor_code ='"+doctor+"' " +
                " WHERE t.del='1' AND t.doctor_code ='"+doctor+"' " +
                " AND t.team_code = " +id+")";
                " AND t.team_code = " +id+")";
        //审核数目
        //审核数目
        Map<String, Object> reviewedCount = jdbcTemplate.queryForMap(sql);
        Map<String, Object> reviewedCount = jdbcTemplate.queryForMap(sql);
@ -1213,4 +1227,199 @@ public class DoctorSchemeService {
        }
        }
        return (Long)reviewedCount.get("reviewedCount");
        return (Long)reviewedCount.get("reviewedCount");
    }
    }
    public Map<String,Object> getTrackPatientAimByteam(String doctor ,Long teamCode,String startDate,String endDate){
        startDate = startDate +" 00:00:00";
        endDate = endDate +" 23:59:59";
        String presSql="SELECT " +
                " COUNT(1) AS dbCount " +
                " FROM " +
                " ( " +
                "  SELECT " +
                "   i.`user`, " +
                "   COUNT(1) AS total " +
                "  FROM " +
                "   device.wlyy_patient_health_index i " +
                "    WHERE  " +
                "   i.`user` in  " +
                "    ( " +
                "     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.del ='1' " +
                "  AND i.type = 2  " +
                "  AND i.record_date >= '"+startDate+"' " +
                "  AND i.record_date <= '"+endDate+"' " +
                "  GROUP BY " +
                "   i.`user` " +
                " ) tt " +
                " LEFT JOIN  " +
                " ( " +
                " SELECT " +
                "  i.`user`, " +
                "  COUNT(1) AS dbtotal " +
                " FROM " +
                "  device.wlyy_patient_health_index i " +
                " JOIN wlyy_patient_aim_blood_pressure p ON p.patientcode = i.`user` " +
                " WHERE " +
                "  i.`user` in  " +
                "    ( " +
                "     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.del ='1'  " +
                "  AND i.type = 2   " +
                "  AND i.record_date >= '"+startDate+"' " +
                "  AND i.record_date <= '"+endDate+"' " +
                " GROUP BY " +
                "  i.`user` " +
                " ) dbt ON tt.`user`=dbt.`user` " +
                " WHERE dbt.dbtotal/tt.total > 0.7";
        Map<String,Object> rs = new HashedMap();
        List<Map<String,Object>> presTotal = jdbcTemplate.queryForList(presSql);
        if(presTotal!=null&&presTotal.size()>0){
            rs.put("dbPresCount",presTotal.get(0).get("dbCount"));
        }else {
            rs.put("dbPresCount",0);
        }
        //餐前达标数量
        List<Map<String,Object>> cqXT = jdbcTemplate.queryForList(getXTSql( doctor , teamCode, startDate, endDate, "0"));
        Long cqtotal;
        if(cqXT!=null&&cqXT.size()>0){
            cqtotal = (Long)cqXT.get(0).get("dbCount");
        }else{
            cqtotal = 0L;
        }
        //餐后达标数量
        List<Map<String,Object>> chXT = jdbcTemplate.queryForList(getXTSql( doctor , teamCode, startDate, endDate, "1"));
        Long chtotal;
        if(chXT!=null&&chXT.size()>0){
            chtotal = (Long)chXT.get(0).get("dbCount");
        }else{
            chtotal = 0L;
        }
        rs.put("dbSuggerCount",chtotal+cqtotal);
        return rs;
    }
    /**
     *
     * @param doctor
     * @param teamCode
     * @param startDate
     * @param endDate
     * @param state 0 餐前,1餐后
     * @return
     */
    public String getXTSql(String doctor ,Long teamCode,String startDate,String endDate,String state){
        String value2 ="1,3,5,7";
        if("1".equals(state)){
            value2 = "2,4,6";
        }
        //餐前血糖达标数
        String xtSql = "SELECT " +
                " COUNT(1) AS dbCount " +
                " FROM " +
                " ( " +
                "  SELECT " +
                "   i.`user`, " +
                "   COUNT(1) AS total " +
                "  FROM " +
                "   device.wlyy_patient_health_index i " +
                "    WHERE  " +
                "   i.`user` in  " +
                "    ( " +
                "     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.del ='1' " +
                "  AND i.type = 1  " +
                "  AND i.record_date >= '"+startDate+"' " +
                "  AND i.record_date <= '"+endDate+"' " +
                "  GROUP BY " +
                "   i.`user` " +
                " ) tt " +
                " LEFT JOIN  " +
                " ( " +
                " SELECT " +
                "  i.`user`, " +
                "  COUNT(1) AS dbtotal " +
                " FROM " +
                "  device.wlyy_patient_health_index i " +
                " JOIN wlyy_patient_aim_blood_sugger p ON p.patientcode = i.`user` " +
                " WHERE " +
                "  i.`user` in  " +
                "    ( " +
                "     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  " +
                "  AND  " +
                "  i.value1 >= p.fbg_min  " +
                "  AND i.value2 in("+value2+") " +
                "  AND i.del ='1'  " +
                "  AND i.type = 1   " +
                "  AND i.record_date >= '"+startDate+"' " +
                "  AND i.record_date <= '"+endDate+"' " +
                " GROUP BY " +
                "  i.`user` " +
                " ) dbt ON tt.`user`=dbt.`user` " +
                " WHERE dbt.dbtotal/tt.total > 0.7";
        return xtSql;
    }
    public Map<String,Object> getDeviceStateByTeam(String doctor ,Long teamCode){
        String sql ="SELECT " +
                " COUNT(1) AS total " +
                " FROM " +
                " wlyy_patient_device d JOIN  " +
                " wlyy_track_patient t ON t.patient_code = d.`user` " +
                " WHERE  " +
                " t.del='1' " +
                " AND d.category_code = ? " +
                " AND t.doctor_code = '"+doctor+"' " +
                " AND t.team_code = "+teamCode;
        Map<String,Object> rs = new HashedMap();
        //血糖仪
        List<Map<String,Object>> xt = jdbcTemplate.queryForList(sql,new Object[]{"1"});
        if(xt!=null&&xt.size()>0){
            rs.put("suggerDevCount",xt.get(0).get("total"));
        }else{
            rs.put("suggerDevCount",0);
        }
        //血压计
        List<Map<String,Object>> xh = jdbcTemplate.queryForList(sql,new Object[]{"2"});
        if(xh!=null&&xh.size()>0){
            rs.put("presDevCount",xh.get(0).get("total"));
        }else{
            rs.put("presDevCount",0);
        }
        return rs;
    }
    public String setPatientAim(String patients ,String suggerJson,String presJson){
        if(StringUtils.isNotBlank(patients)){
            String[] patient = patients.split(",");
            for(String p : patient){
                net.sf.json.JSONObject sj  = net.sf.json.JSONObject.fromObject(suggerJson);
                net.sf.json.JSONObject pj  = net.sf.json.JSONObject.fromObject(presJson);
                PatientAimBloodSugger patientAimBloodSugger = (PatientAimBloodSugger)net.sf.json.JSONObject.toBean(sj,PatientAimBloodSugger.class);
                PatientAimBloodPressure patientAimBloodPressure = (PatientAimBloodPressure)net.sf.json.JSONObject.toBean(pj,PatientAimBloodPressure.class);
                patientAimBloodSugger.setCode(getCode());
                patientAimBloodSugger.setCreateTime(new Date());
                patientAimBloodSuggerDao.save(patientAimBloodSugger);
                patientAimBloodPressure.setCode(getCode());
                patientAimBloodPressure.setCreateTime(new Date());
                patientAimBloodPressureDao.save(patientAimBloodPressure);
            }
        }
        return "0";
    }
}
}

+ 4 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/jimeiJkEdu/JMJkEduArticleService.java

@ -161,6 +161,7 @@ public class JMJkEduArticleService extends BaseService {
            heapm.setSendCode(one.getDoctorCode());
            heapm.setSendCode(one.getDoctorCode());
//            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            heapm.setCreateTime(DateUtil.dateToStrLong(one.getCreateTime()));
            heapm.setCreateTime(DateUtil.dateToStrLong(one.getCreateTime()));
            heapm.setCzrq(DateUtil.dateToStrLong(one.getCzrq()));//阅读时间
            heapm.setArticleId(article.getString("articleId"));
            heapm.setArticleId(article.getString("articleId"));
            heapm.setAttachedTitle(article.getString("articleTitle"));
            heapm.setAttachedTitle(article.getString("articleTitle"));
            heapm.setAttachedContent(article.getString("articleContent"));
            heapm.setAttachedContent(article.getString("articleContent"));
@ -937,7 +938,7 @@ public class JMJkEduArticleService extends BaseService {
    }
    }
    private void getPatientByGroup(String userCode,String labelCode, String labelType, Long teamCode, Set<String> patientSet, int page, int pagesize) throws Exception {
    private void getPatientByGroup(String userCode,String labelCode, String labelType, Long teamCode, Set<String> patientSet, int page, int pagesize) throws Exception {
        org.json.JSONArray result = signPatientLabelInfoService.getPatientByLabel(userCode, labelCode, labelType, teamCode, page, pagesize, false, "",true);
        org.json.JSONArray result = signPatientLabelInfoService.getPatientByLabel(userCode, labelCode, labelType, teamCode, page, pagesize, false, "",true,null);
        for (Object o : result) {
        for (Object o : result) {
            org.json.JSONObject json = (org.json.JSONObject) o;
            org.json.JSONObject json = (org.json.JSONObject) o;
            String patient = (String) json.get("code");
            String patient = (String) json.get("code");
@ -1138,6 +1139,7 @@ public class JMJkEduArticleService extends BaseService {
            }
            }
            for (HealthEduArticleES healthEduArticleES:dataList) {
            for (HealthEduArticleES healthEduArticleES:dataList) {
                healthEduArticleES.setIsRead(1);
                healthEduArticleES.setIsRead(1);
                healthEduArticleES.setCzrq(new Date());
            }
            }
            elastricSearchSave.save(dataList,esIndex,esType);
            elastricSearchSave.save(dataList,esIndex,esType);
            jestClient.shutdownClient();
            jestClient.shutdownClient();
@ -1180,6 +1182,7 @@ public class JMJkEduArticleService extends BaseService {
            }
            }
            for (HealthEduArticleES healthEduArticleES:dataList) {
            for (HealthEduArticleES healthEduArticleES:dataList) {
                healthEduArticleES.setIsRead(1);
                healthEduArticleES.setIsRead(1);
                healthEduArticleES.setCzrq(new Date());
            }
            }
            elastricSearchSave.save(dataList,esIndex,esType);
            elastricSearchSave.save(dataList,esIndex,esType);
            jestClient.shutdownClient();
            jestClient.shutdownClient();

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java

@ -512,7 +512,7 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
    }
    }
    private void getPatientByGroup(String labelCode, String labelType, Long teamCode, Set<String> patientSet, int page, int pagesize) throws Exception {
    private void getPatientByGroup(String labelCode, String labelType, Long teamCode, Set<String> patientSet, int page, int pagesize) throws Exception {
        JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize, false, "",false);
        JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize, false, "",false,null);
        for (Object o : result) {
        for (Object o : result) {
            JSONObject json = (JSONObject) o;
            JSONObject json = (JSONObject) o;
            String patient = (String) json.get("code");
            String patient = (String) json.get("code");

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

@ -137,12 +137,25 @@ public class SignPatientLabelInfoController extends BaseController {
        }
        }
    }
    }
    @RequestMapping(value = "/getTrackFlag", method = RequestMethod.POST)
    @ApiOperation("获取重点关注居民状态")
    public String getTrackFlag(@ApiParam(name="patient",value="患者Code")@RequestParam(required = true)String patient){
        try {
            String rs =  labelInfoService.getTrackFlag(patient,getUID());
            return write(200, "查询成功", "data", rs);
        } catch (Exception e) {
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value = "/setTrackPatient", method = RequestMethod.POST)
    @RequestMapping(value = "/setTrackPatient", method = RequestMethod.POST)
    @ApiOperation("设置居民重点关注")
    @ApiOperation("设置居民重点关注")
    public String setTrackPatient(@ApiParam(name="patient",value="患者Code")@RequestParam(required = false)String patient){
    public String setTrackPatient(@ApiParam(name="patient",value="患者Code")@RequestParam(required = true)String patient,
                                  @ApiParam(name="state",value="1开启,0删除")@RequestParam(required = true)String state){
        try {
        try {
            String rs =  labelInfoService.setTrackPatient(patient,getUID());
            String rs =  labelInfoService.setTrackPatient(patient,getUID(),state);
            if("-1".equals(rs)){
            if("-1".equals(rs)){
                return error(-1, "查询失败,未找到签约关系");
                return error(-1, "查询失败,未找到签约关系");
            }
            }
@ -171,7 +184,8 @@ public class SignPatientLabelInfoController extends BaseController {
                                        @RequestParam(required = false) int pagesize,
                                        @RequestParam(required = false) int pagesize,
                                        @RequestParam(required = false) String diseaseCondition,
                                        @RequestParam(required = false) String diseaseCondition,
                                        @RequestParam(required = false) boolean isSlowDisease,
                                        @RequestParam(required = false) boolean isSlowDisease,
                                        @RequestParam(required = false) boolean isFollowWeChat) {
                                        @RequestParam(required = false) boolean isFollowWeChat,
                                        @RequestParam(required = false) String trackFlag) {
        try {
        try {
            if (StringUtils.isEmpty(labelCode)) {
            if (StringUtils.isEmpty(labelCode)) {
                return error(-1, "标签cdoe不能为空");
                return error(-1, "标签cdoe不能为空");
@ -192,7 +206,7 @@ public class SignPatientLabelInfoController extends BaseController {
                return write(200, "查询成功", "data", jsonObject);
                return write(200, "查询成功", "data", jsonObject);
            }
            }
            JSONArray result = labelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition,isFollowWeChat);
            JSONArray result = labelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition,isFollowWeChat,trackFlag);
//            JSONArray result = labelInfoService.getPatientByLabel("xy201703150222", labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition,isFollowWeChat);
//            JSONArray result = labelInfoService.getPatientByLabel("xy201703150222", labelCode, labelType, teamCode, page, pagesize,isSlowDisease,diseaseCondition,isFollowWeChat);
            return write(200, "查询成功", "data", result);
            return write(200, "查询成功", "data", result);
@ -309,7 +323,8 @@ public class SignPatientLabelInfoController extends BaseController {
            @RequestParam(required = false) String labelType,
            @RequestParam(required = false) String labelType,
            @RequestParam(required = false) Long teamCode,
            @RequestParam(required = false) Long teamCode,
            @RequestParam(required = false) boolean isSlowDisease,
            @RequestParam(required = false) boolean isSlowDisease,
            @RequestParam(required = false) String diseaseCondition) {
            @RequestParam(required = false) String diseaseCondition,
            @RequestParam(required = false)String trackFlag) {
        try {
        try {
            if (StringUtils.isEmpty(labelType)) {
            if (StringUtils.isEmpty(labelType)) {
                return error(-1, "标签类型不能为空");
                return error(-1, "标签类型不能为空");
@ -331,7 +346,7 @@ public class SignPatientLabelInfoController extends BaseController {
                return write(200, "查询成功", "data", r);
                return write(200, "查询成功", "data", r);
            }
            }
            JSONArray result = labelInfoService.getPatientAmountByLabelType(getUID(), labelType, teamCode,isSlowDisease,diseaseCondition);
            JSONArray result = labelInfoService.getPatientAmountByLabelType(getUID(), labelType, teamCode,isSlowDisease,diseaseCondition,trackFlag);
            return write(200, "查询成功", "data", result);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {
        } catch (Exception e) {

+ 42 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/scheme/DoctroSchemeController.java

@ -36,11 +36,12 @@ public class DoctroSchemeController extends BaseController {
            @ApiParam(name="teamCode", value="团队CODE") @RequestParam(value = "teamCode",required = true,defaultValue = "642") String teamCode,
            @ApiParam(name="teamCode", value="团队CODE") @RequestParam(value = "teamCode",required = true,defaultValue = "642") String teamCode,
            @ApiParam(name="disease", value="疾病类型,-1全部,0健康,1高血压,2糖尿病,3高血压+糖尿病",defaultValue = "-1") @RequestParam(value = "disease",required = true) Integer disease,
            @ApiParam(name="disease", value="疾病类型,-1全部,0健康,1高血压,2糖尿病,3高血压+糖尿病",defaultValue = "-1") @RequestParam(value = "disease",required = true) Integer disease,
            @ApiParam(name="diseaseCondition", value="居民标签:0绿标,1黄标,2红标",defaultValue = "0,1,2") @RequestParam(value = "diseaseCondition",required = true) String diseaseCondition,
            @ApiParam(name="diseaseCondition", value="居民标签:0绿标,1黄标,2红标",defaultValue = "0,1,2") @RequestParam(value = "diseaseCondition",required = true) String diseaseCondition,
            @ApiParam(name="deviceType", value="设备类型:-1全部,0未绑定,1已绑定",defaultValue = "-1") @RequestParam(value = "deviceType",required = true) Integer deviceType
            @ApiParam(name="deviceType", value="设备类型:-1全部,0未绑定,1已绑定",defaultValue = "-1") @RequestParam(value = "deviceType",required = true) Integer deviceType,
            @ApiParam(name="trackFlag", value="过滤跟踪居民:1为过滤跟踪,不传或其他值为不过滤",defaultValue = "-1") @RequestParam(value = "trackFlag",required = false)String trackFlag
            ){
            ){
        try {
        try {
            List<String> result = doctorSchemeService.getPatientsByDiseaseConditionDiseaseDeviceType(teamCode,disease,diseaseCondition,deviceType,getUID());
            List<String> result = doctorSchemeService.getPatientsByDiseaseConditionDiseaseDeviceType(teamCode,disease,diseaseCondition,deviceType,getUID(),trackFlag);
            return write(200, "查询成功", "data", result);
            return write(200, "查询成功", "data", result);
        }catch (Exception e){
        }catch (Exception e){
@ -210,6 +211,7 @@ public class DoctroSchemeController extends BaseController {
    }
    }
    @RequestMapping(value="setDoctorSwitchTrackPatient",method = RequestMethod.GET)
    @RequestMapping(value="setDoctorSwitchTrackPatient",method = RequestMethod.GET)
    @ApiOperation("医生跟踪预警居民开关接口")
    @ApiOperation("医生跟踪预警居民开关接口")
    @ObserverRequired
    public String setDoctorSwitchTrackPatient(@ApiParam(name="state", value="0不自动跟踪居民,1自动跟踪预警居民") @RequestParam(value = "state",required = true)String state){
    public String setDoctorSwitchTrackPatient(@ApiParam(name="state", value="0不自动跟踪居民,1自动跟踪预警居民") @RequestParam(value = "state",required = true)String state){
        try {
        try {
            return write(200, "操作成功", "data",doctorSchemeService.setDoctorSwitchTrackPatient(getUID(),state));
            return write(200, "操作成功", "data",doctorSchemeService.setDoctorSwitchTrackPatient(getUID(),state));
@ -278,6 +280,44 @@ public class DoctroSchemeController extends BaseController {
        }
        }
    }
    }
    @RequestMapping(value="getTrackPatientAimByteam",method = RequestMethod.GET)
    @ApiOperation(" 获取团队医生下,居民近一周控制目标情况")
    public String getTrackPatientAimByteam( @ApiParam(name="teamCode", value="团队Code") @RequestParam(value = "teamCode",required = true)Long teamCode,
                                           @ApiParam(name="startDate", value="开始时间,YYYY-MM-dd") @RequestParam(value = "startDate",required = true)String startDate,
                                           @ApiParam(name="endDate", value="结束时间,YYYY-MM-dd") @RequestParam(value = "endDate",required = true)String endDate){
        try {
            return write(200, "查询成功", "data",doctorSchemeService.getTrackPatientAimByteam(getUID(),teamCode,startDate,endDate));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value="getDeviceStateByTeam",method = RequestMethod.GET)
    @ApiOperation("获取团队医生下,居民设备绑定情况")
    public String getDeviceStateByTeam(@ApiParam(name="teamCode", value="团队Code") @RequestParam(value = "teamCode",required = true)Long teamCode){
        try {
            return write(200, "查询成功", "data",doctorSchemeService.getDeviceStateByTeam(getUID(),teamCode));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "查询失败");
        }
    }
    @RequestMapping(value="setPatientAim",method = RequestMethod.GET)
    @ApiOperation("批量控制目标设置")
    public String setPatientAim(@ApiParam(name="patient", value="患者code,用“,”分割") @RequestParam(value = "patient",required = true)String patient,
                                @ApiParam(name="suggerJson", value="血糖目标实体") @RequestParam(value = "suggerJson",required = true)String suggerJson,
                                @ApiParam(name="pressureJson", value="血压目标实体") @RequestParam(value = "pressureJson",required = true)String pressureJson){
        try {
            return write(200, "操作成功", "data",doctorSchemeService.setPatientAim(patient,suggerJson,pressureJson));
        }catch (Exception e){
            error(e);
            //返回接口异常信息处理结果
            return error(-1, "操作失败");
        }
    }
}
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcLableController.java

@ -101,7 +101,7 @@ public class GcLableController extends BaseController {
            @ApiParam(name = "isFollowWeChat", value = "是否过滤微信关注居民", required = false) @RequestParam(value="isFollowWeChat",required = false,defaultValue = "false") boolean isFollowWeChat
            @ApiParam(name = "isFollowWeChat", value = "是否过滤微信关注居民", required = false) @RequestParam(value="isFollowWeChat",required = false,defaultValue = "false") boolean isFollowWeChat
    ) {
    ) {
        try {
        try {
            JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page-1, pageSize, isSlowDisease, "",isFollowWeChat);
            JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page-1, pageSize, isSlowDisease, "",isFollowWeChat,null);
            List<PatientModel> patientLabelModels = new ArrayList<>();
            List<PatientModel> patientLabelModels = new ArrayList<>();
            for (int i = 0; i < result.length(); i++) {
            for (int i = 0; i < result.length(); i++) {
                JSONObject jo = result.getJSONObject(i);
                JSONObject jo = result.getJSONObject(i);

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

@ -59,6 +59,7 @@ public class HealthEduArticlePatientModel {
    private String computeTime;//时间
    private String computeTime;//时间
    private String photo;//医生头像
    private String photo;//医生头像
    private String operatorName;//文章作者
    private String operatorName;//文章作者
    private String czrq;//阅读时间
    public String getSendCode() {
    public String getSendCode() {
        return sendCode;
        return sendCode;
@ -267,4 +268,12 @@ public class HealthEduArticlePatientModel {
    public void setReadNumber(Long readNumber) {
    public void setReadNumber(Long readNumber) {
        this.readNumber = readNumber;
        this.readNumber = readNumber;
    }
    }
    
    public String getCzrq() {
        return czrq;
    }
    
    public void setCzrq(String czrq) {
        this.czrq = czrq;
    }
}
}

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

@ -100,7 +100,7 @@ public class EduLableController extends BaseController {
            @ApiParam(name = "isFollowWeChat", value = "是否过滤微信关注居民", required = true) @RequestParam(value="isFollowWeChat",required = false,defaultValue = "false") boolean isFollowWeChat
            @ApiParam(name = "isFollowWeChat", value = "是否过滤微信关注居民", required = true) @RequestParam(value="isFollowWeChat",required = false,defaultValue = "false") boolean isFollowWeChat
    ) {
    ) {
        try {
        try {
            JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page-1, pageSize, isSlowDisease, "",isFollowWeChat);
            JSONArray result = signPatientLabelInfoService.getPatientByLabel(getUID(), labelCode, labelType, teamCode, page-1, pageSize, isSlowDisease, "",isFollowWeChat,null);
            List<PatientModel> patientLabelModels = new ArrayList<>();
            List<PatientModel> patientLabelModels = new ArrayList<>();
            for (int i = 0; i < result.length(); i++) {
            for (int i = 0; i < result.length(); i++) {
                JSONObject jo = result.getJSONObject(i);
                JSONObject jo = result.getJSONObject(i);