瀏覽代碼

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

zd_123 7 年之前
父節點
當前提交
0dc5fd765b
共有 19 個文件被更改,包括 944 次插入114 次删除
  1. 395 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientVO.java
  2. 2 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/health/PatientHealthIndexService.java
  3. 161 65
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/label/SignPatientLabelInfoService.java
  4. 4 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java
  5. 56 12
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/sign/FamilyContractService.java
  6. 5 5
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  7. 140 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/fzzb/HealthEducationArticleService.java
  8. 53 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/health/DoctorHealthEduArticleController.java
  9. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/SignPatientLabelInfoController.java
  10. 40 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/HealthEduArticleController.java
  11. 19 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java
  12. 3 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/controller/doctor/GcEduArticleController.java
  13. 35 15
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/service/GcEduArticleService.java
  14. 6 0
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml
  15. 5 0
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  16. 5 0
      patient-co/patient-co-wlyy/src/main/resources/application-local.yml
  17. 4 0
      patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml
  18. 5 0
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  19. 5 0
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml

+ 395 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/vo/PatientVO.java

@ -0,0 +1,395 @@
package com.yihu.wlyy.entity.patient.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
 * 居民VO类
 * @author huangwenjie
 * @date 2017/11/21 08:57
 */
public class PatientVO {
	
	// 业务主键
	private String code;
	// 身份证号
	private String idcard;
	// 登录密码
	private String password;
	private String salt;
	// 姓名
	private String name;
	// 生日
	private Date birthday;
	// 性別,1男,2女
	private Integer sex;
	// 手機號
	private String mobile;
	// (基卫)手機號
	private String mobileRemarks;
	// 聯繫電話
	private String phone;
	// 社保卡號
	private String ssc;
	// 頭像HTTP地址
	private String photo;
	// 省代碼
	private String province;
	// 城市代碼
	private String city;
	// 區縣代碼
	private String town;
	// 街道代码
	private String street;
	// 省名
	private String provinceName;
	// 市名
	private String cityName;
	// 區縣名
	private String townName;
	// 街道名称
	private String streetName;
	// 地址
	private String address;
	// 疾病类型,0健康,1高血压,2糖尿病,3高血压+糖尿病
	private Integer disease;
	// 病情:0绿标,1黄标,2红标
	private Integer diseaseCondition;
	// 病历记录总数
	private Integer recordAmount;
	// 總積分
	private Integer points;
	// 更新時間
	private Date czrq;
	// 微信编号
	private String openid;
	//微信时间
	private Date openidTime;
	// 用户状态:1正常,0禁用,-1恶意注册,2审核中
	private Integer status;
	// 居委会字段id
	private String sickVillage;
	// 居委会字段名称
	private String sickVillageName;
	//	绑定电子社保卡主体(本人为本人code,共济为操作人code)
	private String principalCode;
	//	是否绑定电子社保卡
	private Integer sicardStatus;
	//	绑定电子社保卡时间
	private Date sicardTime;
	//是否分配过微信标签  1分配过 0或者空没有
	private Integer isWxtag;
	//微信iagId
	private Integer wxtagid;
	//居民预警状态:0为标准,1为预警状态
	private Integer standardStatus;
	
	//设备类型(1血糖,2血压,3血糖+血压)
	private Integer deviceType;
	
	public String getCode() {
		return code;
	}
	
	public void setCode(String code) {
		this.code = code;
	}
	
	public String getIdcard() {
		return idcard;
	}
	
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	
	public String getPassword() {
		return password;
	}
	
	public void setPassword(String password) {
		this.password = password;
	}
	
	public String getSalt() {
		return salt;
	}
	
	public void setSalt(String salt) {
		this.salt = salt;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}
	
	@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
	public Date getBirthday() {
		return birthday;
	}
	
	public void setBirthday(Date birthday) {
		this.birthday = birthday;
	}
	
	public Integer getSex() {
		return sex;
	}
	
	public void setSex(Integer sex) {
		this.sex = sex;
	}
	
	public String getMobile() {
		return mobile;
	}
	
	public void setMobile(String mobile) {
		this.mobile = mobile;
	}
	
	public String getMobileRemarks() {
		return mobileRemarks;
	}
	
	public void setMobileRemarks(String mobileRemarks) {
		this.mobileRemarks = mobileRemarks;
	}
	
	public String getPhone() {
		return phone;
	}
	
	public void setPhone(String phone) {
		this.phone = phone;
	}
	
	public String getSsc() {
		return ssc;
	}
	
	public void setSsc(String ssc) {
		this.ssc = ssc;
	}
	
	public String getPhoto() {
		return photo;
	}
	
	public void setPhoto(String photo) {
		this.photo = photo;
	}
	
	public String getProvince() {
		return province;
	}
	
	public void setProvince(String province) {
		this.province = province;
	}
	
	public String getCity() {
		return city;
	}
	
	public void setCity(String city) {
		this.city = city;
	}
	
	public String getTown() {
		return town;
	}
	
	public void setTown(String town) {
		this.town = town;
	}
	
	public String getStreet() {
		return street;
	}
	
	public void setStreet(String street) {
		this.street = street;
	}
	
	public String getProvinceName() {
		return provinceName;
	}
	
	public void setProvinceName(String provinceName) {
		this.provinceName = provinceName;
	}
	
	public String getCityName() {
		return cityName;
	}
	
	public void setCityName(String cityName) {
		this.cityName = cityName;
	}
	
	public String getTownName() {
		return townName;
	}
	
	public void setTownName(String townName) {
		this.townName = townName;
	}
	
	public String getStreetName() {
		return streetName;
	}
	
	public void setStreetName(String streetName) {
		this.streetName = streetName;
	}
	
	public String getAddress() {
		return address;
	}
	
	public void setAddress(String address) {
		this.address = address;
	}
	
	public Integer getDisease() {
		return disease;
	}
	
	public void setDisease(Integer disease) {
		this.disease = disease;
	}
	
	public Integer getDiseaseCondition() {
		return diseaseCondition;
	}
	
	public void setDiseaseCondition(Integer diseaseCondition) {
		this.diseaseCondition = diseaseCondition;
	}
	
	public Integer getRecordAmount() {
		return recordAmount;
	}
	
	public void setRecordAmount(Integer recordAmount) {
		this.recordAmount = recordAmount;
	}
	
	public Integer getPoints() {
		return points;
	}
	
	public void setPoints(Integer points) {
		this.points = points;
	}
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getCzrq() {
		return czrq;
	}
	
	public void setCzrq(Date czrq) {
		this.czrq = czrq;
	}
	
	public String getOpenid() {
		return openid;
	}
	
	public void setOpenid(String openid) {
		this.openid = openid;
	}
	
	public Date getOpenidTime() {
		return openidTime;
	}
	
	public void setOpenidTime(Date openidTime) {
		this.openidTime = openidTime;
	}
	
	public Integer getStatus() {
		return status;
	}
	
	public void setStatus(Integer status) {
		this.status = status;
	}
	
	public String getSickVillage() {
		return sickVillage;
	}
	
	public void setSickVillage(String sickVillage) {
		this.sickVillage = sickVillage;
	}
	
	public String getSickVillageName() {
		return sickVillageName;
	}
	
	public void setSickVillageName(String sickVillageName) {
		this.sickVillageName = sickVillageName;
	}
	
	public String getPrincipalCode() {
		return principalCode;
	}
	
	public void setPrincipalCode(String principalCode) {
		this.principalCode = principalCode;
	}
	
	public Integer getSicardStatus() {
		return sicardStatus;
	}
	
	public void setSicardStatus(Integer sicardStatus) {
		this.sicardStatus = sicardStatus;
	}
	
	public Date getSicardTime() {
		return sicardTime;
	}
	
	public void setSicardTime(Date sicardTime) {
		this.sicardTime = sicardTime;
	}
	
	public Integer getIsWxtag() {
		return isWxtag;
	}
	
	public void setIsWxtag(Integer isWxtag) {
		this.isWxtag = isWxtag;
	}
	
	public Integer getWxtagid() {
		return wxtagid;
	}
	
	public void setWxtagid(Integer wxtagid) {
		this.wxtagid = wxtagid;
	}
	
	public Integer getStandardStatus() {
		return standardStatus;
	}
	
	public void setStandardStatus(Integer standardStatus) {
		this.standardStatus = standardStatus;
	}
	
	public Integer getDeviceType() {
		return deviceType;
	}
	
	public void setDeviceType(Integer deviceType) {
		this.deviceType = deviceType;
	}
}

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

@ -625,52 +625,47 @@ public class PatientHealthIndexService extends BaseService {
                        obj.put("value1", data);
                        obj.put("time1", recordDate);
                        obj.put("id1", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn1", deviceSn);
                        hadData = true;
                    } else if (dataType.equals("2")) {
                        obj.put("value2", data);
                        obj.put("time2", recordDate);
                        obj.put("id2", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn2", deviceSn);
                        hadData = true;
                    } else if (dataType.equals("3")) {
                        obj.put("value3", data);
                        obj.put("time3", recordDate);
                        obj.put("id3", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn3", deviceSn);
                        hadData = true;
                    } else if (dataType.equals("4")) {
                        obj.put("value4", data);
                        obj.put("time4", recordDate);
                        obj.put("id4", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn4", deviceSn);
                        hadData = true;
                    } else if (dataType.equals("5")) {
                        obj.put("value5", data);
                        obj.put("time5", recordDate);
                        obj.put("id5", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn5", deviceSn);
                        hadData = true;
                    } else if (dataType.equals("6")) {
                        obj.put("value6", data);
                        obj.put("time6", recordDate);
                        obj.put("id6", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn6", deviceSn);
                        hadData = true;
                    } else if (dataType.equals("7")) {
                        obj.put("value7", data);
                        obj.put("time7", recordDate);
                        obj.put("id7", id);
                        obj.put("healthindexid", id);
                        obj.put("deviceSn7", deviceSn);
                        hadData = true;
                    }
                    obj.put("healthindexid", id);
                    obj.put("dataType",dataType);
                }
            }
        }

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

@ -9,6 +9,8 @@ import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.patient.PatientDisease;
import com.yihu.wlyy.entity.patient.PatientRemindRecords;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.entity.patient.vo.PatientVO;
import com.yihu.wlyy.entity.statistics.WlyyQuotaResult;
import com.yihu.wlyy.logs.BusinessLogs;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorPatientGroupInfoDao;
@ -27,6 +29,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -319,6 +322,33 @@ public class SignPatientLabelInfoService extends BaseService {
                    " f. CODE = s.sign_code " +
                    " AND s.server_type ='"+labelCode+"'  ORDER BY f.ptOpenid DESC";
            args = new Object[]{doctor, doctor, teamCode};
        }else if("3".equals(labelType) && isSlowDisease){
            //慢病管理
            sql = "SELECT " +
                    "    DISTINCT t1.* " +
                    " FROM " +
                    "    wlyy_sign_family t1, " +
                    "    wlyy_sign_patient_label_info t2 ";
            if(StringUtils.isNotBlank(diseaseCondition)) {
                sql = sql + ", wlyy_patient p ";
            }
            sql = sql + " WHERE t2.label = ?";
    
            if(StringUtils.isNotBlank(diseaseCondition)) {
                sql = sql + " AND p.disease_condition = ? ";
            }
    
            sql = sql + "    AND t2.label_type = ? " +
                    "    AND t2.status = 1 " +
                    "    AND t1.patient = t2.patient " +
                    "    AND (t1.doctor = ? or t1.doctor_health = ?)" +
                    "    AND t1.status > 0 " +
                    "    AND t1.admin_team_code = ? order by t1.openid desc,convert(t1.name using gbk) ";
            if(StringUtils.isNotBlank(diseaseCondition)) {
                args = new Object[]{labelCode, diseaseCondition, labelType, doctor, doctor, teamCode};
            }else{
                args = new Object[]{labelCode, labelType, doctor, doctor,  teamCode};
            }
        } else {
            if (labelCode.equals("0")) {
                sql = "SELECT " +
@ -371,9 +401,22 @@ public class SignPatientLabelInfoService extends BaseService {
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                if (p == null) {
//                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
//
//                if (p == null) {
//                    continue;
//                }
    
                PatientVO p = new PatientVO();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3" +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
        
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                }else{
                    continue;
                }
@ -980,7 +1023,7 @@ public class SignPatientLabelInfoService extends BaseService {
     * @param teamCode  标签类型为4时,不能为空
     * @return
     */
    public JSONArray getPatientAmountByLabelType(String doctor, String labelType, Long teamCode) throws Exception {
    public JSONArray getPatientAmountByLabelType(String doctor, String labelType, Long teamCode, boolean isSlowDisease, String diseaseCondition) throws Exception {
        Doctor doc = doctorDao.findByCode(doctor);
        if (doc == null) {
@ -1014,18 +1057,19 @@ public class SignPatientLabelInfoService extends BaseService {
                int amount = 0;
                String sql = "";
                Object[] args = null;
                Calendar today = Calendar.getInstance();
                Calendar startDate = Calendar.getInstance();
                SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
                if (labelType.equals("5")) {
                    Calendar today = Calendar.getInstance();
                    Calendar startDate = Calendar.getInstance();
                    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
    
                    sql = "select count(DISTINCT t1.patient) count" +
                            " from " +
                            "     wlyy_sign_family t1," +
                            "     wlyy_patient t3 " +
                            " where t1.patient = t3.code AND (t1.doctor = ? or t1.doctor_health = ?) and t1.status > 0 " +
                            (teamCode > 0 ? " and t1.admin_team_code = ? " : "");
    
                    if (label.getLabelCode().equals("1")) {
                        int week = today.get(Calendar.DAY_OF_WEEK) - 2;
                        if (week == -1) {
@ -1050,6 +1094,28 @@ public class SignPatientLabelInfoService extends BaseService {
                    } else {
                        args = new Object[]{doctor, doctor};
                    }
                }else if(labelType.equals("3") && isSlowDisease) {
                    sql = " SELECT " +
                            "     count(DISTINCT t1.patient) count" +
                            " FROM" +
                            "     wlyy_sign_family t1, " +
                            "     wlyy_sign_patient_label_info t2, " +
                            "     wlyy_patient t3 " +
                            " WHERE" +
                            "     t1.patient = t2.patient " +
                            "     AND t1.patient = t3.code "+
                            "     AND t2.label = ? " +
                            "     AND t2.label_type = ? " +
                            "     AND t2.status = 1 " +
                            "     AND (t1.doctor = ? or t1.doctor_health = ?)" +
                            "     AND t1.status > 0 " +
                            (teamCode > 0 ? "    AND t1.admin_team_code = ? " : "");
    
                    if (teamCode > 0) {
                        args = new Object[]{label.getLabelCode(), labelType, doctor, doctor, teamCode};
                    } else {
                        args = new Object[]{label.getLabelCode(), labelType, doctor, doctor};
                    }
                } else {
                    if (label.getLabelCode().equals("0")) {
                        sql = " SELECT " +
@ -3586,7 +3652,7 @@ public class SignPatientLabelInfoService extends BaseService {
        Map<String, JSONObject> result = new TreeMap<>();
        List<Map<String, Object>> signList = new ArrayList<>();
        Map<String,Object> patientDeviceTypeMap = new HashMap<>();//用于存储患者设备绑定情况
//        Map<String,Object> patientDeviceTypeMap = new HashMap<>();//用于存储患者设备绑定情况
        int start = page * pagesize;
        String sql = "";
        Object[] args = null;
@ -3652,7 +3718,32 @@ public class SignPatientLabelInfoService extends BaseService {
                    " AND s.server_type ='"+labelCode+"' " +
                    " ORDER BY " +
                    " f.ptOpenid DESC";
        }else if("3".equals(labelType) && isSlowDisease){
            //慢病管理
            sql = "SELECT " +
                    "    DISTINCT t1.* " +
                    " FROM " +
                    "    wlyy_sign_family t1, " +
                    "    wlyy_sign_patient_label_info t2 ";
            if(StringUtils.isNotBlank(diseaseCondition)) {
                sql = sql + ", wlyy_patient p ";
            }
            sql = sql + " WHERE t2.label = ?";
    
            if(StringUtils.isNotBlank(diseaseCondition)) {
                sql = sql + " AND p.disease_condition = ? ";
            }
    
            sql = sql + "    AND t2.label_type = ? " +
                    "    AND t2.status = 1 " +
                    "    AND t1.patient = t2.patient " +
                    "    AND t1.status > 0 " +
                    "    AND t1.admin_team_code = ? order by t1.openid desc,convert(t1.name using gbk) ";
            if(StringUtils.isNotBlank(diseaseCondition)) {
                args = new Object[]{labelCode,diseaseCondition, labelType, teamCode};
            }else{
                args = new Object[]{labelCode, labelType, teamCode};
            }
        }else {
            if ("0".equals(labelCode)) {
                sql = "SELECT " +
@ -3700,23 +3791,36 @@ public class SignPatientLabelInfoService extends BaseService {
        sql = sql + " limit " + start + "," + pagesize;
        signList = jdbcTemplate.queryForList(sql, args);
        //查询患者设备绑定情况
        String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
        List<Map<String,Object>> patientCodeDeviceTypes =  jdbcTemplate.queryForList(_pdsql);
        if(!patientCodeDeviceTypes.isEmpty()){
            for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
                String user = String.valueOf(patientCodeDeviceType.get("user"));
                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
                patientDeviceTypeMap.put(user,sum);
            }
        }
//        //查询患者设备绑定情况
//        String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
//        List<Map<String,Object>> patientCodeDeviceTypes =  jdbcTemplate.queryForList(_pdsql);
//
//        if(!patientCodeDeviceTypes.isEmpty()){
//            for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
//                String user = String.valueOf(patientCodeDeviceType.get("user"));
//                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
//                patientDeviceTypeMap.put(user,sum);
//            }
//        }
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                if (p == null) {
            
//                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
//                if (p == null) {
//                    continue;
//                }
                //查找居民 改造成获取绑定的设备和疾病类型--huangwenjie-2017.11.21
                PatientVO p = new PatientVO();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3" +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
    
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                }else{
                    continue;
                }
@ -3825,12 +3929,13 @@ public class SignPatientLabelInfoService extends BaseService {
                json.put("diseaseCondition",p.getDiseaseCondition());
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
//
//                String deviceType = "";
//                if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
//                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
//                }
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                String deviceType = "";
                if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
                }
                json.put("deviceType",deviceType);
                json.put("deviceType",p.getDeviceType());
                boolean epTime = false;
@ -4067,8 +4172,6 @@ public class SignPatientLabelInfoService extends BaseService {
                                                           int page, int pagesize) throws Exception {
        Doctor doc = doctorDao.findByCode(doctor);
        Map<String,Object> patientDeviceTypeMap = new HashMap<>();//用于存储患者设备绑定情况
        if (doc == null) {
            throw new Exception("doctor info can not find");
        }
@ -4099,7 +4202,7 @@ public class SignPatientLabelInfoService extends BaseService {
                (StringUtils.isNotEmpty(labelCode) ? " AND t2.label = ? " : "") +
                (StringUtils.isNotEmpty(labelType) ? " AND t2.label_type = ? " : "") +
                (teamCode > 0 ? (" AND admin_team_code = " + teamCode) : "");
        sql = sql + " AND t3.disease > 0 AND t3.status > 0 ";
        sql = sql + " AND t3.status > 0 and t2.label_type = '3' and ( t2.label =1 or t2.lable = 2) ";
        if (matcher.find()) {
            sql = sql + "  AND (t1.idcard like ?) ";
@ -4122,16 +4225,22 @@ public class SignPatientLabelInfoService extends BaseService {
        }
        sql = sql + " order by t3.standard_status,t3.disease_condition,t3.disease,t3.openid desc limit " + page + "," + pagesize;
        sql = sql + " order by t3.standard_status,t3.disease_condition,t2.label,t3.openid desc limit " + page + "," + pagesize;
        signList = jdbcTemplate.queryForList(sql, args);
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                System.out.println("1111");
                if (p == null) {
                PatientVO p = new PatientVO();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3" +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
        
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                }else{
                    continue;
                }
@ -4264,11 +4373,7 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                String deviceType = "";
                if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
                }
                json.put("deviceType",deviceType);
                json.put("deviceType",p.getDeviceType());
                boolean epTime = false;
                try {
@ -4301,7 +4406,6 @@ public class SignPatientLabelInfoService extends BaseService {
    public JSONArray searchSlowDiseaseTeamsPatients(String filter, long teamCode, int page, int pagesize, String diseaseCondition) throws Exception {
        Map<String, JSONObject> result = new HashMap<>();
        List<Map<String, Object>> signList = new ArrayList<>();
        Map<String,Object> patientDeviceTypeMap = new HashMap<>();//用于存储患者设备绑定情况
        page = page * pagesize;
        //String reg = "(^\\d{15}$)|(^\\d{17}([0-9]|X)$)";
@ -4316,6 +4420,7 @@ public class SignPatientLabelInfoService extends BaseService {
                " FROM " +
                "    wlyy_sign_family t1 " +
                " JOIN wlyy_patiend t2 ON t1.patient = t2.code " +
                " JOIN wlyy_sign_patient_label_info t3 on t1.patient = t3.patient " +
                " WHERE " +
                (isIdcard ? " t1.patient = t2.code  and " : "") +
                "    t1.status > 0 " +
@ -4323,28 +4428,23 @@ public class SignPatientLabelInfoService extends BaseService {
                "  AND" +
                (isIdcard ? " t2.idcard like ? " : " t1.name like ? ");
        sqlTemp = sqlTemp + " AND t2.disease_condition = "+diseaseCondition+" AND t2.disease >0 AND t2.status >0 ";
        sqlTemp = sqlTemp + " AND t2.disease_condition = "+diseaseCondition+" AND t2.status >0 and t3.label_type = 3 and (t3.label = 1 or t3.label = 2)";
        String sql = sqlTemp + " order by t2.standard_status,t2.disease_condition,t2.disease,t2.openid desc  limit " + page + "," + pagesize;
        String sql = sqlTemp + " order by t2.standard_status,t2.disease_condition,t3.label,t2.openid desc  limit " + page + "," + pagesize;
        signList = jdbcTemplate.queryForList(sql, args);
        //查询患者设备绑定情况
        String _pdsql = "select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user";
        List<Map<String,Object>> patientCodeDeviceTypes =  jdbcTemplate.queryForList(_pdsql);
        if(!patientCodeDeviceTypes.isEmpty()){
            for (Map<String,Object> patientCodeDeviceType : patientCodeDeviceTypes) {
                String user = String.valueOf(patientCodeDeviceType.get("user"));
                String sum = String.valueOf(patientCodeDeviceType.get("deviceType"));
                patientDeviceTypeMap.put(user,sum);
            }
        }
        if (signList != null && signList.size() > 0) {
            for (Map<String, Object> sign : signList) {
                Patient p = patientDao.findByCode(sign.get("patient") == null ? "" : sign.get("patient").toString());
                if (p == null) {
                PatientVO p = new PatientVO();
                if(sign.get("patient") != null){
                    String patientsql = "select a.*,b.deviceType as deviceType,c.disease as disease from wlyy_patient a" +
                            "  left join (select user,sum(category_code) deviceType FROM wlyy_patient_device GROUP BY user) b on a.code = b.user" +
                            "  left join (select patient,group_concat(label) disease from wlyy_sign_patient_label_info where label_type = 3" +
                            " and (label = 1 or label = 2) and patient = '"+sign.get("patient").toString()+"' GROUP BY patient) c on a.code = c.patient" +
                            " where a.status =1 and a.code = '"+sign.get("patient").toString()+"'";
        
                    p = (PatientVO)jdbcTemplate.queryForObject(patientsql,new BeanPropertyRowMapper(PatientVO.class));
                }else{
                    continue;
                }
@ -4460,11 +4560,7 @@ public class SignPatientLabelInfoService extends BaseService {
                //预警状态
                json.put("standardStatus",p.getStandardStatus());
                //设备状态:0未绑定,1血糖仪,2血压仪,3血糖仪+血压仪
                String deviceType = "";
                if(!patientDeviceTypeMap.isEmpty() && patientDeviceTypeMap.keySet().contains(p.getCode())){
                    deviceType = (String) patientDeviceTypeMap.get(p.getCode());
                }
                json.put("deviceType",deviceType);
                json.put("deviceType",p.getDeviceType());
                boolean epTime = false;
                try {

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

@ -314,14 +314,17 @@ public class PrescriptionFollowupContentService extends BaseService {
		if(StringUtils.isNotBlank(healthindexid) || !list.isEmpty()){
			
			JSONObject obj = new JSONObject();
			Integer valueType = 0;
			
			//如果有传体征ID,则查体征数据
			if(StringUtils.isNotBlank(healthindexid)){
				DevicePatientHealthIndex devicePatientHealthIndex = devicePatientHealthIndexDao.findOne(new Long(healthindexid));
				obj = (JSONObject)JSON.toJSON(devicePatientHealthIndex);
				valueType = obj.getInteger("value2");
			}else{
				//如果没传体征ID,则获取最近的一条
				obj = (JSONObject)list.get(0);
				valueType = obj.getInteger("dataType");
			}
			
			imBloodSugarDate = obj.getDate("recordDate");
@ -330,7 +333,7 @@ public class PrescriptionFollowupContentService extends BaseService {
			if(StringUtils.isNotBlank(obj.getString("value1"))){
				
				
				Integer valueType = obj.getInteger("value2");
				
				
				//餐前
				if(1 == valueType || 3 == valueType || 5 == valueType){

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

@ -377,7 +377,7 @@ public class FamilyContractService extends BaseService {
     * @param patient 患者标识
     * @return
     */
    public JSONObject findJiMeiDoctorMainPage(String patient, String doctor) {
    public JSONObject findJiMeiDoctorMainPage(String patient, String doctor,Integer page,Integer pagesize) {
        JSONObject json = new JSONObject();
        // 查询医生基本信息
        Doctor d = doctorDao.findByCode(doctor);
@ -395,19 +395,29 @@ public class FamilyContractService extends BaseService {
        json.put("level", d.getLevel());
        SignFamily sf = signFamilyDao.findByjiatingPatient(patient);
        if(sf==null||!sf.getHospital().startsWith("350211")){
            //未签约和不是集美签约的按原有接口走
        }else {
            //获取健康文章
            com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
            try {
                jsonArray = healthEducationArticleService.getDoctorArticalByUserId(null,1,null,0,3,doctor);
            }catch (Exception e){
                logger.error("获取福州健康文章失败,"+e.getMessage());
        if (sf == null) {
            // 没有签约信息
            json.put("sign", -1);
            json.put("isjimei", 0);
        } else {
            // 有签约信息
            json.put("sign", sf.getStatus());
            if(sf.getHospital().startsWith("350211")){
                json.put("isjimei", 1);
            }else {
                json.put("isjimei", 0);
            }
            json.put("healthEduArticles",jsonArray);
        }
        //获取健康文章
        com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
        try {
            jsonArray = healthEducationArticleService.getDoctorArticalByUserId(null,1,null,page,pagesize,doctor);
        }catch (Exception e){
            logger.error("获取福州健康文章失败,"+e.getMessage());
        }
        json.put("healthEduArticles",jsonArray);
        return json;
    }
@ -2057,6 +2067,40 @@ public class FamilyContractService extends BaseService {
        return result;
    }
    /**
     * 获取签约医生
     * @param patientCode
     * @return
     */
    public com.alibaba.fastjson.JSONArray getSignDoctors(String patientCode){
        com.alibaba.fastjson.JSONArray jsonArray = new com.alibaba.fastjson.JSONArray();
        SignFamily jtSignFamily = signFamilyDao.findFamilySignByPatient(patientCode);
        if (jtSignFamily != null) {
            Patient patient = patientDao.findByCode(patientCode);
            Doctor doctor = doctorDao.findByCode(jtSignFamily.getDoctor());
            if (doctor != null) {
                com.alibaba.fastjson.JSONObject jo = new com.alibaba.fastjson.JSONObject();
                jo.put("code", doctor.getCode());
                jo.put("sex", doctor.getSex());
                jo.put("name", doctor.getName());
                jo.put("photo", doctor.getPhoto());
                jo.put("hosptialName", doctor.getHospitalName());
                jo.put("level", doctor.getLevel());
                jo.put("signType", "2");//2是家庭
                jo.put("signStatus", jtSignFamily.getStatus());
                jo.put("jobName", doctor.getJobName());
                jo.put("disease", patient.getDisease());//0健康,1高血压,2糖尿病,3高血压+糖尿病
                if (jtSignFamily.getStatus() == 0) {
                    jo.put("sqDate", DateUtil.dateToStrShort(jtSignFamily.getPatientApplyDate()));//申请时间
                } else {
                    jo.put("qyDate", DateUtil.dateToStrShort(jtSignFamily.getBegin()));//签约时间
                    jo.put("endDate", DateUtil.dateToStrShort(jtSignFamily.getEnd()));//结束时间
                }
                jsonArray.add(jo);
            }
        }
        return jsonArray;
    }
    public JSONArray getSignDoctorMessage(String patientCode) {
        JSONArray jsonArray = new JSONArray();
        //找出患者的三师签约信息

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

@ -1261,13 +1261,13 @@ public class StatisticsESService {
                        int num = 0;
                        int taskNum = 0;
                        if (low_level.equals("3")) {
                        if (lowCode.equals("3")) {
                            num = peopleNum.getSixFiveNum();
                            taskNum = peopleNum.getSixFiveTaskNum();
                        } else if (low_level.equals("5")) {
                        } else if (lowCode.equals("1")) {
                            num = peopleNum.getGxyNum();
                            taskNum = peopleNum.getGxyTaskNum();
                        } else if (low_level.equals("4")) {
                        } else if (lowCode.equals("2")) {
                            num = peopleNum.getTnbNum();
                            taskNum = peopleNum.getTnbTaskNum();
                        }
@ -1473,10 +1473,10 @@ public class StatisticsESService {
                        if (lowCode.equals("3")) {
                            num = peopleNum.getSixFiveNum();
                            taskNum = peopleNum.getSixFiveTaskNum();
                        } else if (lowCode.equals("5")) {
                        } else if (lowCode.equals("1")) {
                            num = peopleNum.getGxyNum();
                            taskNum = peopleNum.getGxyTaskNum();
                        } else if (lowCode.equals("4")) {
                        } else if (lowCode.equals("2")) {
                            num = peopleNum.getTnbNum();
                            taskNum = peopleNum.getTnbTaskNum();
                        }

+ 140 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/fzzb/HealthEducationArticleService.java

@ -3,19 +3,25 @@ package com.yihu.wlyy.service.third.fzzb;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.es.entity.HealthEduArticlePatient;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ElasticsearchUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.web.third.gateway.vo.DictModel;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.util.HashMap;
import java.util.Map;
import java.util.*;
/**
 * 福州总部-健康教育医生APP接口文档
@ -31,6 +37,16 @@ public class HealthEducationArticleService extends BaseService{
    private HttpClientUtil httpClientUtil;
    @Autowired
    private DoctorDao doctorDao;
    @Value("${es.type.HealthEduArticlePatient}")
    private String esType;
    @Value("${es.index.HealthEduArticlePatient}")
    private String esIndex;
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private HealthEducationArticleService healthEducationArticleService;
//    private String baseUrl = "http://service.yihu.com:8085/WsPlatform/rest";
    private String baseUrl = "http://172.17.110.230:83/WsPlatform/rest";
@ -332,4 +348,126 @@ public class HealthEducationArticleService extends BaseService{
            throw new Exception(json.getString("Message"));
        }
    }
//    public JSONArray getPatientHealthLogs(int page, int pagesize,String sendCode, String articleType)throws Exception{
//
//        pagesize = page * pagesize;
//        page = (page - 1) * pagesize;
//        StringBuffer sql = new StringBuffer("select *,count(articleId) allCount from   " + esType +
//                " where  sendCode='" + sendCode + "' ");
//        if (!StringUtils.isEmpty(articleType)) {
//            sql.append(" and  articleType='" + articleType + "'  ");
//        }
//        sql.append(" group by articleId order by createTime limit " + page + "," + pagesize);
//        List<HealthEduArticlePatient> esList = elasticsearchUtil.excute(sql.toString(), com.yihu.es.entity.HealthEduArticlePatient.class, esIndex, esType);
//        for(HealthEduArticlePatient one :esList){
//            JSONObject jsonObject = getArticalById(one.getArticleId());
//
//        }
//        return null;
//    }
    public JSONArray labelWithPushPatients(String labelType){
        String sql = "";
        List<DictModel> returnList = null;
        JSONArray re = new JSONArray();
        switch (labelType) {
            case "1": {
                sql = "select s.code code,s.name name from wlyy_sign_dict s where s.year='2017' order by s.sort asc";
                returnList = jdbcTemplate.query(sql, new BeanPropertyRowMapper(DictModel.class));
                sql = "select count(DISTINCT(w.patient)) as num from wlyy_sign_family w "+
                        " left join wlyy_sign_family_server s on w.code= s.sign_code "+
                        " left join wlyy_patient p on p.code=w.patient "+
                        " where w.status>0 and p.town='350211' ";
                for(DictModel one:returnList){
                    sql +=" s.server_type='"+one.getCode()+"'";
                    Map<String, Object> map = jdbcTemplate.queryForMap(sql);
                    JSONObject obj = new JSONObject();
                    obj.put("code",one.getCode());
                    obj.put("name",one.getName());
                    obj.put("num",(Long)map.get("num"));
                    re.add(obj);
                }
                break;
            }
            case "2": {
                sql = "select label_code code, label_name name from wlyy_sign_patient_label  where label_type=2 and status=1";
                break;
            }
            case "3": {
                sql = "select label_code code, label_name name from wlyy_sign_patient_label  where label_type=3 and status=1";
                break;
            }
            case "4": {
                sql = "select label_code code, label_name name from wlyy_sign_patient_label  where label_type=4 and status=1";
                break;
            }
        }
        return re;
    }
    public JSONArray pushArticleLogs(int page, int pagesize,String patientCode)throws Exception{
        pagesize = page * pagesize;
        page = (page - 1) * pagesize;
//
//        StringBuffer sql2 = new StringBuffer("select *  from   " + esType +
//                " where  sendCode='" + sendCode + "' ");
//        sql2.append("  order by createTime limit " + page + "," + pagesize);
        String sql = "SELECT * FROM "+esType+"  where nested(patients.code)= '"+patientCode+"' order by createTime desc limit "+ page + "," + pagesize;
        List<com.yihu.es.entity.HealthEduArticlePatient> esList = elasticsearchUtil.excute(sql, com.yihu.es.entity.HealthEduArticlePatient.class, esIndex, esType);
        HealthEduArticlePatientModel heapm = null;
        com.alibaba.fastjson.JSONObject article = null;
        List<HealthEduArticlePatientModel> result = new ArrayList<>();
        for (HealthEduArticlePatient one : esList) {
            article = healthEducationArticleService.getArticalById(one.getArticleId());
            heapm = new HealthEduArticlePatientModel();
            heapm.setSendName(one.getSendName());
            heapm.setSendCode(one.getSendCode());
            heapm.setCreateTime(one.getCreateTime());
            heapm.setArticleId(article.getString("articleId"));
            heapm.setAttachedTitle(article.getString("articleTitle"));
            heapm.setAttachedContent(article.getString("articleContent"));
            heapm.setArticleType(article.getString("articleType"));
            heapm.setLevel1Type(article.getString("firstLevelCategoryId"));
            heapm.setLevel2Type(article.getString("secondLevelCategoryId"));
            heapm.setLevel(article.getString("articlelevel"));
            heapm.setAllCount(heapm.getAllCount() + one.getPatients().size());
            heapm.setBrowseNumbere(Integer.valueOf(article.getString("browseNumber")));//文章浏览数
            heapm.setCommentNumber(Integer.valueOf(article.getString("commentNumber")));//文章评论数
            heapm.setPointNumber(Integer.valueOf(article.getString("pointNumber")));//文章点赞数
            heapm.setArticleCover(article.getString("articleCover"));//封面
            heapm.setComputeTime(computeTime(article.getString("insertTime")));
            result.add(heapm);
            // heapm.setTime();//时间  xx小时前  2017-10-11
        }
        JSONArray re = new JSONArray();
        re.addAll(result);
        return re;
    }
    public  String computeTime(String create) {
        Date createDate = DateUtil.strToDate(create, "yyyy-MM-dd HH:mm:ss.SSS");
        Date nowDate = new Date();
        //计算2个时间差
        Long l = nowDate.getTime() - createDate.getTime();
        long hour = l / (60 * 60 * 1000); //小时
        long min = l / (60 * 1000);//分钟
        long s = l / 1000;//秒
        if(s<60){
            return s+"秒前";
        }
        if(min<60){
            return min+"分钟前";
        }
        if(hour<24){
            return hour+"小时前";
        }
        return DateUtil.dateToStr(createDate,"yyyy-MM-dd");
    }
}

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

@ -18,7 +18,9 @@ import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImUtill;
import com.yihu.wlyy.web.WeixinBaseController;
import com.yihu.wlyy.web.third.gateway.service.GcEduArticleService;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
import com.yihu.wlyy.wechat.util.WeiXinOpenIdUtils;
import io.swagger.annotations.Api;
@ -86,7 +88,8 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
    private PushMsgTask pushMsgTask;
    @Autowired
    private HealthEducationArticleService healthEducationArticleService;
    @Autowired
    private GcEduArticleService gcEduArticleService;
    /**
     * 查询
     *
@ -755,5 +758,54 @@ public class DoctorHealthEduArticleController extends WeixinBaseController {
        }
    }
    /**医生端-已推送文章
     * @param page
     * @param pagesize
     * @return
     */
    @RequestMapping(value = "logs", method = RequestMethod.GET)
    @ApiOperation("查询医生给患者推送记录 ")
    public ResultPageListModel<HealthEduArticlePatientModel> getPatientHealthLogs(
            @ApiParam(name = "articleType", value = "文章类别", required = false) @RequestParam(value = "articleType", required = false) String articleType,
//            @ApiParam(name = "level1Type", value = "一级分类", required = false) @RequestParam(value = "level1Type", required = false) String level1Type,
//            @ApiParam(name = "level2Type", value = "二级分类", required = false) @RequestParam(value = "level2Type", required = false) String level2Type,
//            @ApiParam(name = "level", value = "等级", required = false) @RequestParam(value = "level", required = false) String level,
//            @ApiParam(name = "doctorCode", value = "医生code,为空从useragent取", required = false) @RequestParam(value = "doctorCode", required = false) String doctorCode,
//            @ApiParam(name = "patientCode", value = "接收人code", required = false) @RequestParam(value = "patientCode", required = false) String patientCode,
//            @ApiParam(name = "articleTitle", value = "文章标题", required = false) @RequestParam(value = "articleTitle", required = false) String articleTitle,
//            @ApiParam(name = "startTime", value = "开始时间yyyy-Mm-dd", required = false) @RequestParam(value = "startTime", required = false) String startTime,
//            @ApiParam(name = "endTime", value = "结束时间yyyy-Mm-dd", required = false) @RequestParam(value = "endTime", required = false) String endTime,
            @ApiParam(name = "page", value = "当前页 起始1", required = true) @RequestParam(value = "page", required = true) Integer page,
            @ApiParam(name = "pagesize", value = "每页显示条数", required = true) @RequestParam(value = "pagesize", required = true) Integer pagesize) {
        try {
            if (pagesize > 1000) {
                pagesize = 1000;
            }
            List<HealthEduArticlePatientModel> eduArticlePatients = gcEduArticleService.pushArticleLogs(page,pagesize,getUID(),2);
            Long count = gcEduArticleService.pushArticleLogsCount(getUID(),2);
            return new ResultPageListModel(
                    page,
                    pagesize,
                    count.intValue()
                    , eduArticlePatients);
        }catch (Exception e) {
            return new ResultPageListModel(BaseResultModel.statusEm.find_error.getCode(), BaseResultModel.statusEm.find_error.getMessage() + "," + e.getMessage());
        }
    }
    @RequestMapping(value = "labelWithPushPatients", method = RequestMethod.GET)
    @ApiOperation("查询推送对象 ")
    public String labelWithPushPatients(
            @ApiParam(name = "labelType", value = "1:服务类型(卫计委分组) 2:健康情况 3:疾病类型 4:团队标签(自定义标签)", required = true) @RequestParam(value = "labelType", required = true) String labelType){
        try {
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.labelWithPushPatients(labelType);
//            Long count = healthEducationArticleService.pushArticleLogsCount("ece5c665b16542b0847e52b4a9fee44a");
            return write(200,"查询成功!","data",response);
        }catch (Exception e) {
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
}

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

@ -314,7 +314,7 @@ public class SignPatientLabelInfoController extends BaseController {
                return write(200, "查询成功", "data", r);
            }
            JSONArray result = labelInfoService.getPatientAmountByLabelType(getUID(), labelType, teamCode);
            JSONArray result = labelInfoService.getPatientAmountByLabelType(getUID(), labelType, teamCode,isSlowDisease,diseaseCondition);
            return write(200, "查询成功", "data", result);
        } catch (Exception e) {

+ 40 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/health/HealthEduArticleController.java

@ -11,6 +11,9 @@ import com.yihu.wlyy.service.common.account.DoctorService;
import com.yihu.wlyy.service.third.fzzb.HealthEducationArticleService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.third.gateway.vo.HealthEduArticlePatientModel;
import com.yihu.wlyy.web.third.gateway.vo.base.BaseResultModel;
import com.yihu.wlyy.web.third.gateway.vo.base.ResultPageListModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -241,5 +244,42 @@ public class HealthEduArticleController extends BaseController {
        }
    }
    @RequestMapping(value = "getCollectionArticalList",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("居民端获取收藏文章列表")
    public String getCollectionArticalList(@ApiParam(name = "articleTitle", value = "文章标题")
                                           @RequestParam(value = "articleTitle", required = false) String articleTitle,
                                           @ApiParam(name = "articleState", value = "文章状态(1、正常、2删除 3、草稿)")
                                           @RequestParam(value = "articleState", required = true) Integer articleState,
                                           @ApiParam(name = "firstLevelCategoryId", value = "一级类别ID ,多个逗号隔开")
                                           @RequestParam(value = "firstLevelCategoryId", required = false) String firstLevelCategoryId,
                                           @ApiParam(name = "pageIndex", value = "起始页数 0开始,默认0")
                                           @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
                                           @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                           @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try {
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,getUID(),2);
//            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.getCollectionArticalList(articleTitle,articleState,firstLevelCategoryId,pageIndex,pageSize,"0de7295862dd11e69faffa163e8aee56",1);
            return write(200,"查询成功!","data",response);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
    @RequestMapping(value = "pushArticleLogs", method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("居民获取被推送文章列表 ")
    public String pushArticleLogs(
            @ApiParam(name = "page", value = "当前页 起始1", required = true) @RequestParam(value = "page", required = true) Integer page,
            @ApiParam(name = "pagesize", value = "每页显示条数", required = true) @RequestParam(value = "pagesize", required = true) Integer pagesize){
        try {
            com.alibaba.fastjson.JSONArray response = healthEducationArticleService.pushArticleLogs(page,pagesize,getUID());
//            Long count = healthEducationArticleService.pushArticleLogsCount("ece5c665b16542b0847e52b4a9fee44a");
            return write(200,"查询成功!","data",response);
        }catch (Exception e) {
            e.printStackTrace();
            return error(-1,"查询失败!");
        }
    }
}

+ 19 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/sign/FamilyContractController.java

@ -81,6 +81,19 @@ public class FamilyContractController extends BaseController {
        }
    }
    @RequestMapping(value = "getSignDoctors")
    @ResponseBody
    @ApiOperation("获取签约医生")
    public String getSignDoctors(){
        try {
            com.alibaba.fastjson.JSONArray array = familyContractService.getSignDoctors(getRepUID());
            return write(200, "获取列表成功!", "list", array);
        } catch (Exception e) {
            error(e);
            return error(-1, "获取列表失败!");
        }
    }
    @RequestMapping(value = "getSignMessageOverdue")
    @ResponseBody
    @ApiOperation("")
@ -227,9 +240,13 @@ public class FamilyContractController extends BaseController {
    @ResponseBody
    @ApiOperation("集美家签医生主页")
    public String jimeiHomepage(@ApiParam(name = "doctor", value = "医生编码")
                                @RequestParam(value = "doctor", required = true) String doctor){
                                @RequestParam(value = "doctor", required = true) String doctor,
                                @ApiParam(name = "pageIndex", value = "起始页数 0开始,默认0")
                                @RequestParam(value = "pageIndex", required = false) Integer pageIndex,
                                @ApiParam(name = "pageSize", value = "每页显示数 ,默认5")
                                @RequestParam(value = "pageSize", required = false) Integer pageSize){
        try{
            JSONObject json = familyContractService.findJiMeiDoctorMainPage(getRepUID(), doctor);
            JSONObject json = familyContractService.findJiMeiDoctorMainPage(getRepUID(), doctor,pageIndex,pageSize);
            return write(200, "医生主页查询成功!", "data", json);
        }catch (Exception e){
            error(e);

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

@ -63,7 +63,7 @@ public class GcEduArticleController extends WeixinBaseController {
    @Value("${activemq.queue.healtHarticleQueue}")
    private String channelName;
    /**
    /**PC端
     * @param doctorCode
     * @param page
     * @param pagesize
@ -206,8 +206,8 @@ public class GcEduArticleController extends WeixinBaseController {
            if (pagesize > 1000) {
                pagesize = 1000;
            }
            List<HealthEduArticlePatientModel> eduArticlePatients = gcEduArticleService.pushArticleLogs(page,pagesize,"wjw00000001000e6badcfa163e424525");
            Long count = gcEduArticleService.pushArticleLogsCount("");
            List<HealthEduArticlePatientModel> eduArticlePatients = gcEduArticleService.pushArticleLogs(page,pagesize,getUID(),1);
            Long count = gcEduArticleService.pushArticleLogsCount(getUID(),1);
            return new ResultPageListModel(
                    page,
                    pagesize,

+ 35 - 15
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/service/GcEduArticleService.java

@ -59,6 +59,8 @@ public class GcEduArticleService {
    private String esType;
    @Value("${es.index.HealthEduArticlePatient}")
    private String esIndex;
    @Value("${jkEdu.web.articleBaseUrl}")
    private String articleBaseUrl;
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
@ -261,7 +263,7 @@ public class GcEduArticleService {
        healthEduArticlePatient.setLevel1Type(article.get("firstLevelCategoryId") + "");
        healthEduArticlePatient.setLevel2Type(article.get("secondLevelCategoryId") + "");
        healthEduArticlePatient.setType("1");//文章
        healthEduArticlePatient.setArticleUrl("");
        healthEduArticlePatient.setArticleUrl(articleBaseUrl+"/web/jkEdu/articleDetail.html?behavior=4&articleId="+articleId);
        healthEduArticlePatient.setPatients(patientList);
        //保存到ES中
@ -486,15 +488,26 @@ public class GcEduArticleService {
//        return healthEduArticlePatients;
//    }
    public List<HealthEduArticlePatientModel> pushArticleLogs(int page, int pagesize, String sendCode) throws Exception {
    /**
     *
     * @param page
     * @param pagesize
     * @param sendCode
     * @param sendType 1、卫计委,2、医生
     * @return
     * @throws Exception
     */
    public List<HealthEduArticlePatientModel> pushArticleLogs(int page, int pagesize, String sendCode,int sendType) throws Exception {
        pagesize = page * pagesize;
        page = (page - 1) * pagesize;
        String sql = "select r.code as roleCode from wlyy_user_role u " +
                "left join wlyy_role r on r.`code`=u.role where u.user='" + sendCode + "'";
        Map<String, Object> resultMap = jdbcTemplate.queryForMap(sql);
        sendCode = resultMap.get("roleCode").toString();
        if(sendType==1){
            String sql = "select r.code as roleCode from wlyy_user_role u " +
                    "left join wlyy_role r on r.`code`=u.role where u.user='" + sendCode + "'";
            Map<String, Object> resultMap = jdbcTemplate.queryForMap(sql);
            sendCode = resultMap.get("roleCode").toString();
        }
        StringBuffer sql2 = new StringBuffer("select *  from   " + esType +
                " where  sendCode='" + sendCode + "' ");
        sql2.append("  order by createTime limit " + page + "," + pagesize);
@ -504,13 +517,6 @@ public class GcEduArticleService {
        com.alibaba.fastjson.JSONObject article = null;
        for (HealthEduArticlePatient one : esList) {
            article = healthEducationArticleService.getArticalById(one.getArticleId());
//            com.yihu.es.entity.HealthEduArticlePatient p = findOne(one.getArticleId());
//            if (p != null) {
//                p.setAllCount(one.getAllCount());
//                HealthEduArticlePatientModel heapm = new HealthEduArticlePatientModel();
//                BeanUtils.copyProperties(p, heapm);
//                returnList.add(heapm);
//            }
            if (result.get(one.getArticleId()) != null) {
                heapm = result.get(one.getArticleId());
@ -544,6 +550,7 @@ public class GcEduArticleService {
        return resultList;
    }
    public static String computeTime(String create) {
        Date createDate = DateUtil.strToDate(create, "yyyy-MM-dd HH:mm:ss.SSS");
        Date nowDate = new Date();
@ -569,8 +576,21 @@ public class GcEduArticleService {
        System.out.println(computeTime("2017-11-16 13:32:00.010"));
    }
    public Long pushArticleLogsCount(String sendCode) {
    /**
     *
     * @param sendCode
     * @param sendType 1、卫计委,2、医生
     * @return
     */
    public Long pushArticleLogsCount(String sendCode,int sendType) {
        if(sendType==1){
            String sql = "select r.code as roleCode from wlyy_user_role u " +
                    "left join wlyy_role r on r.`code`=u.role where u.user='" + sendCode + "'";
            Map<String, Object> resultMap = jdbcTemplate.queryForMap(sql);
            sendCode = resultMap.get("roleCode").toString();
        }
        StringBuffer sql = new StringBuffer("select count(distinct articleId) count  from   " + esType +
                " where  sendCode='" + sendCode + "' ");
        return elasticsearchUtil.excuteForLong(sql.toString(), esIndex, esType);

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

@ -109,6 +109,12 @@ es:
  host:  http://172.19.103.68:9200
  tHost: 172.19.103.68:9300
  clusterName: jkzl
#集美宣教居民端健康文章
jkEdu:
  web:
    articleBaseUrl: http://172.19.103.87:9088/jkeduweb
#消息队列
activemq:
  username: admin

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

@ -108,6 +108,11 @@ es:
  tHost: 172.19.103.68:9300
  clusterName: jkzl
#集美宣教居民端健康文章
#http://172.19.103.87:9088/JkEduWeb
jkEdu:
  web:
    articleBaseUrl: http://172.19.103.87:9088/jkeduweb
#消息队列

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

@ -106,6 +106,11 @@ es:
  tHost: 59.61.92.90:9066,59.61.92.90:9068
  clusterName: jkzl
#集美宣教居民端健康文章
jkEdu:
  web:
    articleBaseUrl: http://172.19.103.87:9088/jkeduweb
#消息队列
activemq:
  username: admin

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

@ -107,6 +107,10 @@ es:
  tHost: 172.19.103.68:9300
  clusterName: jkzl
#集美宣教居民端健康文章
jkEdu:
  web:
    articleBaseUrl: http://172.19.103.87:9088/jkeduweb
#消息队列
activemq:

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

@ -108,6 +108,11 @@ es:
  tHost: 59.61.92.90:9066,59.61.92.90:9068
  clusterName: jkzl
#集美宣教居民端健康文章
jkEdu:
  web:
    articleBaseUrl:
#消息队列
activemq:
  username: admin

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

@ -105,6 +105,11 @@ es:
  tHost: 172.19.103.68:9300
  clusterName: jkzl
#集美宣教居民端健康文章
jkEdu:
  web:
    articleBaseUrl: http://172.19.103.87:9088/jkeduweb
#消息队列
activemq:
  username: admin