浏览代码

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

liuwenbin 7 年之前
父节点
当前提交
516cf4e472
共有 39 个文件被更改,包括 1363 次插入825 次删除
  1. 20 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/reply/DoctorQuickReply.java
  2. 1 1
      common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java
  3. 411 401
      common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/Patient.java
  4. 89 11
      patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/FeedbackService.java
  5. 7 2
      patient-co-manage/wlyy-manage/src/main/resources/application.yml
  6. 31 21
      patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml
  7. 0 111
      patient-co/patient-co-doctor-assistant/src/main/resources/application-devbak.yml
  8. 77 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/controller/QueryController.java
  9. 29 17
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/ConsultTimeConvert.java
  10. 29 13
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DiseaseAndAgeConvert.java
  11. 1 0
      patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/IdCardUtil.java
  12. 61 0
      patient-co/patient-co-statistics-es/src/main/resources/application-devtest.yml
  13. 21 21
      patient-co/patient-co-statistics-es/src/main/resources/application-test.yml
  14. 51 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/SicardQueryJob.java
  15. 4 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java
  16. 53 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/charge/BindCard.java
  17. 81 0
      patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/charge/OnePayService.java
  18. 5 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorQuickReplyDao.java
  19. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java
  20. 2 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java
  21. 135 125
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java
  22. 8 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/prescription/PrescriptionFollowupContentService.java
  23. 21 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/reply/DoctorQuickReplyService.java
  24. 72 64
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  25. 0 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java
  26. 55 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackTemplateController.java
  27. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/prescription/DoctorPrescriptionFollowupContentController.java
  28. 12 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/reply/DoctorQuickReplyController.java
  29. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java
  30. 61 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/feedback/PatientFeedbackTemplateController.java
  31. 0 7
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionFollowupContentController.java
  32. 3 2
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  33. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/StatisticsController.java
  34. 11 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/gateway/vo/PatientModel.java
  35. 1 1
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  36. 1 1
      patient-co/patient-co-wlyy/src/main/resources/application-local.yml
  37. 1 1
      patient-co/patient-co-wlyy/src/main/resources/application-localtest.yml
  38. 1 1
      patient-co/patient-co-wlyy/src/main/resources/application-prod.yml
  39. 1 1
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml

+ 20 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/doctor/reply/DoctorQuickReply.java

@ -23,6 +23,10 @@ public class DoctorQuickReply extends IdEntity {
    private Date updateTime;
    // 状态 1:有效  0:无效
    private Integer status;
    // 类型 0为健康教育,1为续方咨询
    private Integer type;
    // 0为自定义消息  大于0的为系统消息
    private Integer systag;
    public String getDoctor() {
        return doctor;
@ -59,4 +63,20 @@ public class DoctorQuickReply extends IdEntity {
    public void setStatus(Integer status) {
        this.status = status;
    }
    
    public Integer getType() {
        return type;
    }
    
    public void setType(Integer type) {
        this.type = type;
    }
    
    public Integer getSystag() {
        return systag;
    }
    
    public void setSystag(Integer systag) {
        this.systag = systag;
    }
}

文件差异内容过多而无法显示
+ 1 - 1
common/common-entity/src/main/java/com/yihu/wlyy/entity/message/Message.java


+ 411 - 401
common/common-entity/src/main/java/com/yihu/wlyy/entity/patient/Patient.java

@ -15,8 +15,8 @@ import java.util.List;
/**
 * 患者信息
 * @author George
 *
 * @author George
 */
@Entity
@ -24,419 +24,429 @@ import java.util.List;
public class Patient extends IdEntity implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 8358924836164389434L;
	// 业务主键
	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;
//	是否绑定电子社保卡
	private Integer sicardStatus;
//	绑定电子社保卡时间
	private Date sicardTime;
	//是否分配过微信标签  1分配过 0或者空没有
	private Integer isWxtag;
	//微信iagId
	private Integer wxtagid;
	//居民预警状态:0为标准,1为预警状态
	private Integer standardStatus;
	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;
	}
	private List<SignPatientLabelInfo> labelInfos=new ArrayList<>();//患者的疾病标签list
	public Patient() {
	}
	public Patient(Long id) {
		this.id = id;
	}
	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 getPhone() {
		return phone;
	}
	public void setPhone(String phone) {
		this.phone = phone;
	}
    /**
     *
     */
    private static final long serialVersionUID = 8358924836164389434L;
    // 业务主键
    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;
    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;
    }
    private List<SignPatientLabelInfo> labelInfos = new ArrayList<>();//患者的疾病标签list
    public Patient() {
    }
    public Patient(Long id) {
        this.id = id;
    }
    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 getPhone() {
        return phone;
    }
    public void setPhone(String phone) {
        this.phone = phone;
    }
    public String getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    @Column(name = "photo", insertable = false)
    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;
    }
    @Column(name = "province_name")
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    @Column(name = "city_name")
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    @Column(name = "town_name")
    public String getTownName() {
        return townName;
    }
    public void setTownName(String townName) {
        this.townName = townName;
    }
    @Column(name = "street_name")
    public String getStreetName() {
        return streetName;
    }
    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }
    public static long getSerialversionuid() {
        return serialVersionUID;
    }
    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;
    }
    @Column(name = "disease_condition")
    public Integer getDiseaseCondition() {
        return diseaseCondition;
    }
    public void setDiseaseCondition(Integer diseaseCondition) {
        this.diseaseCondition = diseaseCondition;
    }
    @Column(name = "record_amount")
    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 Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Transient
    public List<SignPatientLabelInfo> getLabelInfos() {
        return labelInfos;
    }
    public void setLabelInfos(List<SignPatientLabelInfo> labelInfos) {
        this.labelInfos = labelInfos;
    }
    public String getMobileRemarks() {
        return mobileRemarks;
    }
    public void setMobileRemarks(String mobileRemarks) {
        this.mobileRemarks = mobileRemarks;
    }
    public Date getOpenidTime() {
        return openidTime;
    }
    public void setOpenidTime(Date openidTime) {
        this.openidTime = openidTime;
    }
	public String getSsc() {
		return ssc;
	}
	public void setSsc(String ssc) {
		this.ssc = ssc;
	}
	@Column(name = "photo", insertable = false)
	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;
	}
	@Column(name = "province_name")
	public String getProvinceName() {
		return provinceName;
	}
	public void setProvinceName(String provinceName) {
		this.provinceName = provinceName;
	}
	@Column(name = "city_name")
	public String getCityName() {
		return cityName;
	}
	public void setCityName(String cityName) {
		this.cityName = cityName;
	}
	@Column(name = "town_name")
	public String getTownName() {
		return townName;
	}
	public void setTownName(String townName) {
		this.townName = townName;
	}
	@Column(name = "street_name")
	public String getStreetName() {
		return streetName;
	}
	public void setStreetName(String streetName) {
		this.streetName = streetName;
	}
	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	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;
	}
	@Column(name = "disease_condition")
	public Integer getDiseaseCondition() {
		return diseaseCondition;
	}
	public void setDiseaseCondition(Integer diseaseCondition) {
		this.diseaseCondition = diseaseCondition;
	}
	@Column(name = "record_amount")
	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 Integer getStatus() {
		return status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	@Transient
	public List<SignPatientLabelInfo> getLabelInfos() {
		return labelInfos;
	}
	public void setLabelInfos(List<SignPatientLabelInfo> labelInfos) {
		this.labelInfos = labelInfos;
	}
	public String getMobileRemarks() {
		return mobileRemarks;
	}
	public void setMobileRemarks(String mobileRemarks) {
		this.mobileRemarks = mobileRemarks;
	}
	public Date getOpenidTime() {
		return openidTime;
	}
	public void setOpenidTime(Date openidTime) {
		this.openidTime = openidTime;
	}
    public String getSickVillage() {
        return sickVillage;
    }
	public String getSickVillage() {
		return sickVillage;
	}
    public void setSickVillage(String sickVillage) {
        this.sickVillage = sickVillage;
    }
	public void setSickVillage(String sickVillage) {
		this.sickVillage = sickVillage;
	}
    public String getSickVillageName() {
        return sickVillageName;
    }
	public String getSickVillageName() {
		return sickVillageName;
	}
    public void setSickVillageName(String sickVillageName) {
        this.sickVillageName = sickVillageName;
    }
	public void setSickVillageName(String sickVillageName) {
		this.sickVillageName = sickVillageName;
	}
    public Integer getIsWxtag() {
        return isWxtag;
    }
	public Integer getIsWxtag() {
		return isWxtag;
	}
    public void setIsWxtag(Integer isWxtag) {
        this.isWxtag = isWxtag;
    }
	public void setIsWxtag(Integer isWxtag) {
		this.isWxtag = isWxtag;
	}
    public Integer getWxtagid() {
        return wxtagid;
    }
	public Integer getWxtagid() {
		return wxtagid;
	}
    public void setWxtagid(Integer wxtagid) {
        this.wxtagid = wxtagid;
    }
	public void setWxtagid(Integer wxtagid) {
		this.wxtagid = wxtagid;
	}
    //---------------------------常量----------------------------
    public enum isWchatTage {
        yes(1), no(0);
	//---------------------------常量----------------------------
	public enum isWchatTage{
		yes(1),no(0);
        isWchatTage(Integer value) {
            this.value = value;
        }
		isWchatTage(Integer value) {
			this.value = value;
		}
        private Integer value;
		private Integer value;
        public Integer getValue() {
            return value;
        }
		public Integer getValue() {
			return value;
		}
        public void setValue(Integer value) {
            this.value = value;
        }
    }
		public void setValue(Integer value) {
			this.value = value;
		}
	}
	public Integer getStandardStatus() {
		return standardStatus;
	}
    public Integer getStandardStatus() {
        return standardStatus;
    }
	public void setStandardStatus(Integer standardStatus) {
		this.standardStatus = standardStatus;
	}
    public void setStandardStatus(Integer standardStatus) {
        this.standardStatus = standardStatus;
    }
}

+ 89 - 11
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/feedback/FeedbackService.java

@ -1,13 +1,21 @@
package com.yihu.wlyy.service.manager.feedback;
import com.yihu.wlyy.entity.Doctor;
import com.yihu.wlyy.entity.Followup;
import com.yihu.wlyy.entity.Message;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.feedback.Feedback;
import com.yihu.wlyy.repository.DoctorDao;
import com.yihu.wlyy.repository.MessageDao;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.feedback.FeedbackDao;
import com.yihu.wlyy.service.BaseService;
import com.yihu.wlyy.util.HttpClientUtil;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@ -17,10 +25,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.text.SimpleDateFormat;
import java.util.*;
/**
 * Created by Reece on 2017/5/6.
@ -34,6 +40,10 @@ public class FeedbackService extends BaseService {
    private PatientDao patientDao;
    @Autowired
    private DoctorDao doctorDao;
    @Value("${wlyyService.api}")
    private String wlyyService;
    @Autowired
    private MessageDao messageDao;
    /**
     * 分页查找问题
@ -55,13 +65,13 @@ public class FeedbackService extends BaseService {
        PageRequest pageRequest = new PageRequest(page - 1, rows, sort);
        // 设置查询条件
        Map<String, SearchFilter> filters = new HashMap<>();
        if (type!=-1) {
        if (type != -1) {
            filters.put("type", new SearchFilter("type", SearchFilter.Operator.EQ, type));
        }
        if (identity!=-1) {
        if (identity != -1) {
            filters.put("identity", new SearchFilter("identity", SearchFilter.Operator.EQ, identity));
        }
        if (status!=-1) {
        if (status != -1) {
            filters.put("status", new SearchFilter("status", SearchFilter.Operator.EQ, status));
        }
        // 未删除
@ -126,7 +136,7 @@ public class FeedbackService extends BaseService {
        int status = feedback.getStatus();
//        identity 1、患者 2、医生
        String name = null;
        if(StringUtils.isNotBlank(creater)) {
        if (StringUtils.isNotBlank(creater)) {
            if (identity == 1) {
                name = patientDao.findNameByCode(creater);
            } else {
@ -148,9 +158,9 @@ public class FeedbackService extends BaseService {
    public void delfeedback(String ids) {
        if(ids!=null){
        if (ids != null) {
            String[] _ids = ids.split(",");
            for(String id:_ids){
            for (String id : _ids) {
                Long _id = Long.valueOf(id);
                feedbackDao.delFeedback(_id);
            }
@ -163,10 +173,78 @@ public class FeedbackService extends BaseService {
     * @param result
     * @throws Exception
     */
    public void dealFeedback(Long id,String result) throws Exception {
    public void dealFeedback(Long id, String result) throws Exception {
        Feedback feedback = feedbackDao.findFeedbackById(id);
        feedback.setResult(result);
        feedback.setStatus(2);
        int identity = feedback.getIdentity();
        int type = feedback.getType();
        String typeName = null;
        String creater = feedback.getCreater();
        switch (type) {
            case 1:
                typeName = "优化建议";
                break;
            case 2:
                typeName = "提交bug";
                break;
            case 3:
                typeName = "新功能建议";
                break;
            case 4:
                typeName = "其他";
                break;
        }
        if (identity == 1) {
            //wlyy给患者发送模板消息
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            Patient patient = patientDao.findByCode(creater);
            String patientName = patient.getName();
            String patientOpendID = patient.getOpenid();
            if (StringUtils.isNotEmpty(patientOpendID)) {
                String url = wlyyService + "/patient/feedback/sendTemplate";
                List<NameValuePair> params = new ArrayList<>();
                params.add(new BasicNameValuePair("toUser", patientOpendID));
                params.add(new BasicNameValuePair("url", null));
                params.add(new BasicNameValuePair("first", "您好!您提交的意见反馈已处理"));
                params.add(new BasicNameValuePair("remark", "感谢你的意见"));
                SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                String newDate = formatDate.format(new Date());
                String keywords = patientName + "," + typeName + "," + result + "," + newDate;
                params.add(new BasicNameValuePair("keywords", keywords));
                HttpClientUtil.post(url, params, "UTF-8");
            }
        } else if (identity == 2) {
            SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
            String newDate = formatDate.format(new Date());
            String title = "新增系统消息";
            String content = "您在" + newDate + "提交的意见反馈已处理,您可点此查看处理结果";
            Message message = new Message();
            message.setType(10);
            message.setCode(UUID.randomUUID().toString());
            message.setCzrq(new Date());
            message.setCreateTime(new Date());
            message.setContent(content);
            message.setRead(1);//设置未读
            message.setReceiver(creater);//设置接受医生的code
            message.setSender("system");//设置发送的用户
            message.setTitle(title);
            message.setReadonly(1);//是否只读消息
            //wlyy给医生发送系统消息
            Doctor doctor = doctorDao.findByCode(creater);
            String doctorOpenID = doctor.getOpenid();
            String url = wlyyService + "/patient/feedback/sendMessage";
            List<NameValuePair> params = new ArrayList<>();
            params.add(new BasicNameValuePair("receiver", creater));
            params.add(new BasicNameValuePair("title", title));
            params.add(new BasicNameValuePair("content",content));
            HttpClientUtil.post(url, params, "UTF-8");
            messageDao.save(message);
        }
        feedbackDao.save(feedback);
    }

+ 7 - 2
patient-co-manage/wlyy-manage/src/main/resources/application.yml

@ -75,7 +75,8 @@ yueren:
  api: http://120.77.209.211:8080
doctorAssistant:
  api: http://192.168.131.113:8080
#  api: http://172.19.103.88:10090/wlyy
wlyyService:
  api: http://10.95.22.10:8011/wlyy/
---
spring:
@ -108,6 +109,8 @@ yueren:
  api: http://120.77.209.211:8080
doctorAssistant:
  api: http://172.19.103.88:10090/wlyy
wlyyService:
  api: http://ehr.yihu.com/wlyy/
---
spring:
@ -137,4 +140,6 @@ im-service:
yueren:
  api: http://120.77.209.211:8080
doctorAssistant:
  api: http://www.xmtyw.cn/assistant
  api: http://www.xmtyw.cn/assistant
wlyyService:
  api: http://www.xmtyw.cn/wlyy/

+ 31 - 21
patient-co/patient-co-doctor-assistant/src/main/resources/application-dev.yml

@ -26,30 +26,40 @@ im:
  data_base_name: ichat
wechat:
  appId: wxb3827510b2e15012
  appSecret: c5bdedd909ded9c2ee08028487e6f50d
  appId: wxd03f859efdf0873d
  appSecret: 2935b54b53a957d9516c920a544f2537
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fweixin.xmtyw.cn%2fwlyy-dev
  accId: gh_aa9cd602b84b
  accId: gh_ffd64560fb21
  message:
   ##处方待处理提醒
      template_prescription_pending: 2MKI4j9rGQoXg6-8KMbR7PrPipzz5Su8QUBqWySno2U
      ##服务状态提醒
      template_consult_notice: fgYiMntj1amEkE8_GLUPmAIyssUAroJrNSHqvydt-PQ
      #居民体征异常提醒
      template_abnormal_signs: G3UNiiqf3T_0E_ULP59iGl4_ecAqAlOAuJReDDlv0_w
      #咨询请求通知
      template_consult_request: O-bJ4Hkd-ehWmCkVaiOJjmYTAbJB6FL8_LJHCLYrTH8
      #签约申请通知
      template_sign_request: T54W9ky7NxO9WGqwwJP1YHlP-Q2LNZiE-QXTE0i9Ep8
      #随访提醒
      template_followup_success:  YmTqucDGmergNWh4D1XkokV6m04H6yTKQv23xdu_vKM
      #处理结果通知
      template_treatment_result:  _AuCuXOKlVrG3ro65q0nXyfZKmLpraSYFiskahajHro
      #咨询回复提醒
      template_consult_reply:  sjnflOikO0WqMp4e338G8I0eFUXd6h8ljwgAlPZj5Tw
      #代办事项提醒
      template_schedule_remind:  sjnflOikO0WqMp4e338G8I0eFUXd6h8ljwgAlPZj5Tw
   ##医生追加建议提醒 --签约邀请
   doctor_invitel_template: TLWrBtNE2kBJaFCdVzDOOnQC8N2TtRY9ZxEzwZXQcR0
   #咨询回复
   template_consult_notice: qSOW0DBxO3qEBm4ucG0Ial0jxsOyD7_f2TFK5e-mQEc
   #签约成功
   template_sign_success: hDWV_sknKlhxhOwR5h68OCXbAhRpcgnx9INrT8BybE8
   #签约失败
   template_sign_failed: ezgttXE7rG4rAboQK2ituG1dKq4PeyCj3LxGJWO_vOA
   #健康指导提醒
   template_health_notice: 128RCfyCHi22jW8PZzo7vabKMsA3SBv5VeHaDPr2Bhw
   #解约提醒
   template_termination:  LrrzHjnIF67ww5uQUvSiv3_pVKJiIK4ZE3fKrvsT0AE
   #预约成功
   template_appoint_success:  Bo2yqNczSU9zkg4wXoouv9tSeefZ6TziggWL3dTXPYE
   #预约取消
   template_appoint_failed:  pErTBTdweIdrNRf_1Oo62YtQC0aHwPvtLaCzw44JzCQ
   #缴费提醒
   template_expenses_remind:  BkTGJ8S18qZ3DfaptAXnZznAk8RJjx9v93og5vyO0bs
   #健康教育
   template_healthy_article: LA7erINJ0CSsG2G_ZCrgsDaX3krhsI4qg_NSHEyL_l4
   #医生变更
   template_doctor_change:  TNIDMjduVKgVL4-k71umYLpHROvFB8K6mmm8aZC_EH8
   #问卷调查
   template_doctor_survey:  IjQvzBy0PLeft2kN9mdBhACXPE9I_jyJywJ6B-JRxsY
   #审核结果通知
   template_doctor_audit:  OFyLUeBW3r9trWw-i6pbB1sPSTD4J2recCv_mc-gKxA
   #服务结果通知
   template_doctor_service:  ezr5RlX0nvh7bGU9aVsGDMJbjKDp1uMKP-AGGYXwI5g
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/

+ 0 - 111
patient-co/patient-co-doctor-assistant/src/main/resources/application-devbak.yml

@ -1,111 +0,0 @@
##开发的配置
spring:
  profiles: dev
  datasource:
    wlyy:
      url: jdbc:mysql://172.19.103.77/wlyy?useUnicode:true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: root
      password: 123456
    health:
      url: jdbc:mysql://172.19.103.77/device?useUnicode=true&amp;characterEncoding=utf-8&amp;autoReconnect=true
      username: root
      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
#    password: jkzl_ehr
server:
  server_url: http://weixin.xmtyw.cn/wlyy-dev/
im:
  im_list_get: http://172.19.103.88:3000/
  data_base_name: ichat
wechat:
  appId: wxd03f859efdf0873d
  appSecret: 2935b54b53a957d9516c920a544f2537
  wechat_token: 27eb3bb24f149a7760cf1bb154b08040
  wechat_base_url: http%3a%2f%2fweixin.xmtyw.cn%2fwlyy-dev
  accId: gh_ffd64560fb21
  message:
   ##医生追加建议提醒 --签约邀请
   doctor_invitel_template: TLWrBtNE2kBJaFCdVzDOOnQC8N2TtRY9ZxEzwZXQcR0
   #咨询回复
   template_consult_notice: qSOW0DBxO3qEBm4ucG0Ial0jxsOyD7_f2TFK5e-mQEc
   #签约成功
   template_sign_success: hDWV_sknKlhxhOwR5h68OCXbAhRpcgnx9INrT8BybE8
   #签约失败
   template_sign_failed: ezgttXE7rG4rAboQK2ituG1dKq4PeyCj3LxGJWO_vOA
   #健康指导提醒
   template_health_notice: 128RCfyCHi22jW8PZzo7vabKMsA3SBv5VeHaDPr2Bhw
   #解约提醒
   template_termination:  LrrzHjnIF67ww5uQUvSiv3_pVKJiIK4ZE3fKrvsT0AE
   #预约成功
   template_appoint_success:  Bo2yqNczSU9zkg4wXoouv9tSeefZ6TziggWL3dTXPYE
   #预约取消
   template_appoint_failed:  pErTBTdweIdrNRf_1Oo62YtQC0aHwPvtLaCzw44JzCQ
   #缴费提醒
   template_expenses_remind:  BkTGJ8S18qZ3DfaptAXnZznAk8RJjx9v93og5vyO0bs
   #健康教育
   template_healthy_article: LA7erINJ0CSsG2G_ZCrgsDaX3krhsI4qg_NSHEyL_l4
   #医生变更
   template_doctor_change:  TNIDMjduVKgVL4-k71umYLpHROvFB8K6mmm8aZC_EH8
   #问卷调查
   template_doctor_survey:  IjQvzBy0PLeft2kN9mdBhACXPE9I_jyJywJ6B-JRxsY
   #审核结果通知
   template_doctor_audit:  OFyLUeBW3r9trWw-i6pbB1sPSTD4J2recCv_mc-gKxA
   #服务结果通知
   template_doctor_service:  ezr5RlX0nvh7bGU9aVsGDMJbjKDp1uMKP-AGGYXwI5g
yihu:
  yihu_OpenPlatform_url: http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/
  yihu_OpenPlatform_appId: 9000276
  yihu_OpenPlatform_secret: OKC8BS1KGXTDE9GPP1EO4VYLUXF8DJ7QUP72H613ZXA
fastDFS:
  fastdfs_file_url: http://172.19.103.54:80/
message:
  messageServerUrl: http://10.0.1.3:8080/OpenPlatform/cgiBin/1.0/smsgw/smsSendWS/send
  messageAppId: 9000286
  messageSecret: NW63YK778QPRUD2A6K5SNF7LYRQ888BWOVD6R4FG2VF
images:
  path: /var/local/upload/images
  renew_path: /usr/local/apache-tomcat-8.0.26/webapps/wlyy/images/renew.png
  sign_path: /usr/local/apache-tomcat-8.0.26/webapps/wlyy/images/familycontract.png
sign:
  check_upload: http://172.19.103.87:8011/wlyy_service
express:
  sf_url: http://218.17.248.244:11080/bsp-oisp/sfexpressService
#  sf_url: https://bsp-ois.sit.sf-express.com:9443/bsp-ois/sfexpressServic
  sf_code: SDDF
  sf_check_word: ttzlgGyOQu4L
pushMes:
  # 1为推送redis,0为推送消息队列
  method: 0
  # redis队列名称
  redis_prescription_title: redisPrescription
es:
  index:
    HealthEduArticlePatient: health_edu_article_patient_dev
  type:
    HealthEduArticlePatient: health_edu_article_patient_dev
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
#消息队列
activemq:
  username: admin
  password: admin
  url: tcp://172.19.103.87:61616
  queue:
    healtHarticleQueue: healthArticleChannel_dev  #健康文章推送

+ 77 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/controller/QueryController.java

@ -10,15 +10,21 @@ import com.yihu.wlyy.statistics.etl.save.es.ElasticFactory;
import com.yihu.wlyy.statistics.util.DateUtil;
import com.yihu.wlyy.statistics.util.ElasticsearchUtil;
import com.yihu.wlyy.statistics.vo.SaveModel;
import io.searchbox.client.JestClient;
import io.searchbox.core.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.elasticsearch.action.search.SearchResponse;
import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
import org.elasticsearch.search.builder.SearchSourceBuilder;
import org.json.JSONArray;
import org.json.JSONObject;
import org.nlpcn.es4sql.jdbc.ObjectResult;
import org.nlpcn.es4sql.jdbc.ObjectResultsExtractor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -47,6 +53,13 @@ public class QueryController {
    @Autowired
    private ElasticsearchUtil elasticsearchUtil;
    @Autowired
    private ElasticFactory elasticFactory;
    @Value("${es.type}")
    private String esType;
    @Value("${es.index}")
    private String esIndex;
    @ApiOperation(value = "执行sql")
    @RequestMapping(value = "/excuteSQL", method = RequestMethod.GET)
    public List<SaveModel> excuteSQL(
@ -144,4 +157,68 @@ public class QueryController {
        return returnMap;
    }
    @ApiOperation(value = "删除某一天的某一个指标的数据")
    @RequestMapping(value = "/deleteQuotaWithId", method = RequestMethod.DELETE)
    public String deleteQuota(
            @ApiParam(name = "id", value = "指标id", required = true) @RequestParam(value = "id", required = true) String id,
            @ApiParam(name = "date", value = "时间(yyyy-MM-dd)", required = true) @RequestParam(value = "date", required = true) String date) {
        return  deleteData(DateUtil.strToDate(date, "yyyy-MM-dd"),id).toString();
    }
    @ApiOperation(value = "删除某一天的数据")
    @RequestMapping(value = "/deleteQuota", method = RequestMethod.DELETE)
    public String deleteQuota(
            @ApiParam(name = "date", value = "时间(yyyy-MM-dd)", required = true) @RequestParam(value = "date", required = true) String date) {
        return deleteData(DateUtil.strToDate(date, "yyyy-MM-dd"),null).toString();
    }
    /**
     * 删除 某个指标某一天的某个timelevel的数据
     *
     * @param quotaDate
     * @param quotaCode
     */
    private net.sf.json.JSONObject deleteData(Date quotaDate, String quotaCode) {
        net.sf.json.JSONObject jsonObject = new net.sf.json.JSONObject();
        try {
            JestClient jestClient = elasticFactory.getJestClient();
            //先根据条件查找出来
            SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
            BoolQueryBuilder boolQueryBuilder = new BoolQueryBuilder();
            if (quotaDate != null) {
                boolQueryBuilder.must(QueryBuilders.matchQuery("quotaDate", quotaDate));
            }
            if (!StringUtils.isEmpty(quotaCode)) {
                boolQueryBuilder.must(QueryBuilders.matchQuery("quotaCode", quotaCode));
            }
            searchSourceBuilder.query(boolQueryBuilder
            ).size(500000);//一次取10000条
            Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                    .build();
            SearchResult result = jestClient.execute(search);
            List<SaveModel> saveModels = result.getSourceAsObjectList(SaveModel.class);
            //根据id批量删除
            Bulk.Builder bulk = new Bulk.Builder().defaultIndex(esIndex).defaultType(esType);
            for (SaveModel obj : saveModels) {
                Delete index = new Delete.Builder(obj.getId()).build();
                bulk.addAction(index);
            }
            BulkResult br = jestClient.execute(bulk.build());
            jsonObject.put("flag", br.isSucceeded());
            jsonObject.put("count", saveModels.size());
            return jsonObject;
        } catch (Exception e) {
            jsonObject.put("flag", false);
            jsonObject.put("message", e.getMessage());
            return jsonObject;
        }
    }
}

+ 29 - 17
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/ConsultTimeConvert.java

@ -3,12 +3,16 @@ package com.yihu.wlyy.statistics.etl.convert.wlyy;
import com.yihu.wlyy.entity.dimension.WlyyDimensionQuota;
import com.yihu.wlyy.statistics.etl.convert.Convert;
import com.yihu.wlyy.statistics.util.DateUtil;
import com.yihu.wlyy.statistics.util.IdCardUtil;
import com.yihu.wlyy.statistics.vo.DataModel;
import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.util.StringUtils;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
/**
@ -24,26 +28,13 @@ public class ConsultTimeConvert implements Convert {
    public List<DataModel> convert(JdbcTemplate jdbcTemplate, List<DataModel> oneList, String slaveLevel, WlyyDimensionQuota temp) {
        oneList.stream().forEach(one -> {
            try {
                String value =one.getSlaveKey1();
                String valueStr = "1";
                if (!StringUtils.isEmpty(value)) {
                    try {
                        Integer valueInt = Integer.parseInt(value);
                        if (valueInt <= 28800) {
                            valueStr = "1";
                        }
                        if (valueInt > 28800 && valueInt <= 43200) {
                            valueStr = "2";
                        }
                        if (valueInt > 43200 && valueInt <= 46800) {
                            valueStr = "3";
                        }
                        if (valueInt > 46800 && valueInt <= 64800) {
                            valueStr = "4";
                        }
                        if (valueInt > 64800 && valueInt <= 86400) {
                            valueStr = "5";
                        }
                        Date time= DateUtil.strToDate(one.getSlaveKey1(),"yyyy-MM-dd HH:mm:ss");
                        valueStr= paserReplyTime(time);
                    } catch (Exception e) {
                    }
@ -55,5 +46,26 @@ public class ConsultTimeConvert implements Convert {
        });
        return oneList;
    }
    public String paserReplyTime(Date date){
        if(date!=null){
            Calendar calendar  =  new GregorianCalendar();
            calendar.setTime(date);
            //获取小时
            int hour = calendar.get(calendar.HOUR_OF_DAY);
            if(hour>=0&&hour<8){
                return "1";
            }else if(hour>=8&&hour<12){
                return "2";
            }else if(hour>=12&&hour<13){
                return "3";
            }else if(hour>=13&&hour<18){
                return "4";
            }else if(hour>=18&&hour<24){
                return"5";
            }else{
                return "";
            }
        }
        return "";
    }
}

+ 29 - 13
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/etl/convert/wlyy/DiseaseAndAgeConvert.java

@ -25,8 +25,10 @@ public class DiseaseAndAgeConvert implements Convert {
        List<DataModel> returnList = new ArrayList<>();
        Map<String, List<String>> healthLablesMap = new HashMap<>();//key是患者code value是患者标签 1高血压 2糖尿病 3 65岁以上
        //初始化标签Map
        initHealthLabesMap(jdbcTemplate, healthLablesMap,oneList);
        initHealthLabesMap(jdbcTemplate, healthLablesMap, oneList);
        //把标签Map设置到对应的维度里面
        for (DataModel dataModel : oneList) {
            List<String> labels = healthLablesMap.get(dataModel.getPatient());
            if (labels != null && labels.size() > 0) {
@ -41,6 +43,18 @@ public class DiseaseAndAgeConvert implements Convert {
                    }
                });
            }
            //判断患者是否是老年人是
            int age = IdCardUtil.getAgeForIdcard(dataModel.getIdcard());
            if (age >= 65) {
                try {
                    DataModel dataModelTemp = new DataModel();
                    BeanUtils.copyProperties(dataModel, dataModelTemp);
                    DataModel.class.getMethod("setSlaveKey" + slaveLevel, String.class).invoke(dataModelTemp, "3");
                    returnList.add(dataModelTemp);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        return returnList;
    }
@ -65,17 +79,19 @@ public class DiseaseAndAgeConvert implements Convert {
            labels.add(one.getHealthLable());
            healthLablesMap.put(one.getPatient(), labels);
        });
        //-得到患者的老年人标签
        oneList.stream().forEach(one->{
            int age = IdCardUtil.getAgeForIdcard(one.getIdcard());
            if(age>=65){
                List<String> labels = healthLablesMap.get(one.getPatient());
                if (labels == null) {
                    labels = new ArrayList<String>();
                }
                labels.add(one.getHealthLable());
                healthLablesMap.put(one.getPatient(), labels);
            }
        });
//        //-得到患者的老年人标签
//        oneList.stream().forEach(one->{
//            int age = IdCardUtil.getAgeForIdcard(one.getIdcard());
//            if(age>=65){
//                num++;
//                List<String> labels = healthLablesMap.get(one.getPatient());
//                if (labels == null) {
//                    labels = new ArrayList<String>();
//                }
//                labels.add("3");
//                healthLablesMap.put(one.getPatient(), labels);
//            }
//        });
//        System.out.println("num:" + num);
    }
}

+ 1 - 0
patient-co/patient-co-statistics-es/src/main/java/com/yihu/wlyy/statistics/util/IdCardUtil.java

@ -92,6 +92,7 @@ public class IdCardUtil {
        }
    }
    /**
     * 根据身份证的号码算出当前身份证持有者的年龄
     *

+ 61 - 0
patient-co/patient-co-statistics-es/src/main/resources/application-devtest.yml

@ -0,0 +1,61 @@
spring:
  profiles: test
  datasource:
    primaryReadWrite:
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
    primaryRead:
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
    im: #im库
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
#    primaryReadWrite:
#      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: root
#      password: 123456
#    primaryRead:
#      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: root
#      password: 123456
#    im: #im库
#      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: root
#      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
  followupMessage:
    cron : 0 5 0 * * ?
    jobId : FOLLOWUP_PLAN_JOB
fv:
  jdbc:
    driver: com.mysql.jdbc.Driver
    url: jdbc:mysql://172.17.110.160/fv?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
    username: ssgg
    password: ssgg
systemConfig:
  msg_push_server: http://127.0.0.1:3000
es:
  index: wlyy_quota_test
  type: wlyy_quota_test
  host: 172.19.103.68
  port: 9200
  tPort: 9300
  clusterName: jkzl
wlyy:
  im:
    databaseName: im_new
quartz:
  name: schedulerFactoryBean_cwd

+ 21 - 21
patient-co/patient-co-statistics-es/src/main/resources/application-test.yml

@ -2,30 +2,30 @@ spring:
  profiles: test
  datasource:
#    primaryReadWrite:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    primaryRead:
#      url: jdbc:mysql://172.19.103.85/data_for_stats?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
#    im: #im库
#      url: jdbc:mysql://172.17.110.160/im_new?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: linzhou
#      password: linzhou
    primaryReadWrite:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
    primaryRead:
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
    im: #im库
      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: root
      password: 123456
      url: jdbc:mysql://172.19.103.85/wlyy?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
      username: linzhou
      password: linzhou
#    primaryReadWrite:
#      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: root
#      password: 123456
#    primaryRead:
#      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: root
#      password: 123456
#    im: #im库
#      url: jdbc:mysql://172.19.103.77/wlyy_quota?useUnicode=true&characterEncoding=utf-8&autoReconnect=true
#      username: root
#      password: 123456
  redis:
    host: 172.19.103.88 # Redis server host.

+ 51 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/job/SicardQueryJob.java

@ -0,0 +1,51 @@
package com.yihu.wlyy.job;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.patient.PatientDao;
import com.yihu.wlyy.service.app.charge.OnePayService;
import com.yihu.wlyy.wechat.util.WeiXinAccessTokenUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
/**
 * 处理电子社保卡绑定业务
 * Created by Reece on 2017/9/26/029.
 */
public class SicardQueryJob implements Job {
    private static final Logger logger = LoggerFactory.getLogger(SicardQueryJob.class);
    @Autowired
    private OnePayService payService;
    @Autowired
    private PatientDao patientDao;
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        logger.info("SicardQueryJob start ..........");
        try {
            List<Patient> patientList = patientDao.listNotupdated();
            if (patientList != null && patientList.size() > 0) {
                for (Patient patient : patientList) {
                    try {
                        payService.bindCardList(patient.getOpenid());
                    } catch (Exception e) {
                        logger.info("SicardQueryJob error ..........continue this JOB,CODE:" + patient.getCode() + ",message:" + e.getMessage());
                        continue;
                    }
                }
            }
            logger.info("SicardQueryJob end ..........");
        } catch (Exception e) {
            e.printStackTrace();
            logger.info("SicardQueryJob error ..........,message:" + e.getMessage());
        }
    }
}

+ 4 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/repository/patient/PatientDao.java

@ -69,4 +69,8 @@ public interface PatientDao extends PagingAndSortingRepository<Patient, Long> {
    @Modifying
    @Query("update Patient p set p.diseaseCondition = ?2 where p.idcard = ?1")
    void updatePatientDiseascontionByIdcard(String idcard, Integer diseaseCondition);
    //获取已绑定社保卡但状态未更新数据(过滤掉为空情况)
    @Query(" select p from Patient p where password is null ")
    List<Patient> listNotupdated();
}

+ 53 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/charge/BindCard.java

@ -0,0 +1,53 @@
package com.yihu.wlyy.service.app.charge;
/**
 * 社保卡绑定信息
 * add by hzp at 20170524
 */
public class BindCard {
    private String attachCardNo;
    private String attachIdType;
    private String attachIdNo;
    private String attachName;
    private String attachRelation;   //01配偶 02父母 03子女  98本人 99未知
    public String getAttachCardNo() {
        return attachCardNo;
    }
    public void setAttachCardNo(String attachCardNo) {
        this.attachCardNo = attachCardNo;
    }
    public String getAttachIdType() {
        return attachIdType;
    }
    public void setAttachIdType(String attachIdType) {
        this.attachIdType = attachIdType;
    }
    public String getAttachIdNo() {
        return attachIdNo;
    }
    public void setAttachIdNo(String attachIdNo) {
        this.attachIdNo = attachIdNo;
    }
    public String getAttachName() {
        return attachName;
    }
    public void setAttachName(String attachName) {
        this.attachName = attachName;
    }
    public String getAttachRelation() {
        return attachRelation;
    }
    public void setAttachRelation(String attachRelation) {
        this.attachRelation = attachRelation;
    }
}

+ 81 - 0
patient-co/patient-co-wlyy-job/src/main/java/com/yihu/wlyy/service/app/charge/OnePayService.java

@ -2,9 +2,11 @@ package com.yihu.wlyy.service.app.charge;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.JavaType;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.entity.charge.WlyyCharge;
import com.yihu.wlyy.entity.organization.HospitalMapping;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.entity.ylz.PayConfigura;
import com.yihu.wlyy.repository.charge.ChargeDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
@ -441,4 +443,83 @@ public class OnePayService {
        charge.setUpdateTime(new Date());
        chargeDao.save(charge);
    }
    /**
     * 查询绑卡信息(所有卡)
     */
    public void bindCardList(String openid) throws Exception {
        Boolean isSuccess = true;
        String error = "";
        PayConfigura config = configuraDao.findWorkConfigura();
        try {
            String appId = config.getOnepayAppId();
            String appSecret = config.getOnepayAppSecret();
            OnepayDefaultClient onepayClient = new OnepayDefaultClient(config.getOnepayApi(), appId, appSecret, signType, encryptType);
            RequestParams requestParams = new RequestParams();
            requestParams.setAppId(appId);
            requestParams.setTimestamp(DateUtil.getCurrentDateTime());
            requestParams.setSignType(signType);
            requestParams.setEncryptType(encryptType);
            // 请求报文体参数,详见接口文档各接口——请求参数定义
            // 如医保绑卡信息请求参数
            JSONObject params = new JSONObject();
            params.put("openId", openid);
            params.put("accId", accId); //微信公众号开发者ID
            requestParams.setParam(params);
            requestParams.setTransType(config.getBindCardType());
            ResponseParams<JSONObject> res = onepayClient.execute(requestParams);
            // 如医保卡绑卡信息返回参数
            if (OnepayDefaultClient.isSuccessful(res)) {
                JavaType javaType = objectMapper.getTypeFactory().constructParametricType(List.class, BindCard.class);
                //获取本人绑卡情况
                String idNo = res.getParam().getString("idNo");
                Patient user = patientDao.findByIdcard(idNo);
                String userCode = user.getCode();
                List<BindCard> result = objectMapper.readValue(objectMapper.writeValueAsString(res.getParam().get("attachList")), javaType);
                //更新患者信息
                if (result != null && result.size() > 0) {
                    for (BindCard card : result) {
                        if (!"98".equals(card.getAttachRelation())) {
                            String idcard = card.getAttachIdNo();
                            Patient patient = patientDao.findByIdcard(idcard);
                            patient.setSicardStatus(1);
//                            ********************以绑定时为主****************
                            patient.setSicardTime(new Date());
//                            ************************************
                            patient.setPrincipalCode(userCode);
                            patientDao.save(patient);
                        }
                    }
                }
                user.setSicardStatus(1);
//                            ********************以绑定时为主****************
                user.setSicardTime(new Date());
//                            ************************************
                user.setPrincipalCode(userCode);
                patientDao.save(user);
            } else {
                isSuccess = false;
                error = "请求失败,返回结果:" + res.getRespCode() + "," + res.getRespMsg();
            }
        } catch (Exception ex) {
            isSuccess = false;
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            ex.printStackTrace(pw);
            error = sw.toString();
        }
        if (!isSuccess) {
            throw new Exception(error);
        }
        LOGGER.info(error);
    }
}

+ 5 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/doctor/DoctorQuickReplyDao.java

@ -2,6 +2,7 @@ package com.yihu.wlyy.repository.doctor;
import com.yihu.wlyy.entity.doctor.reply.DoctorQuickReply;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -11,7 +12,7 @@ import java.util.List;
/**
 * Created by lyr-pc on 2016/12/28.
 */
public interface DoctorQuickReplyDao extends PagingAndSortingRepository<DoctorQuickReply, Long> {
public interface DoctorQuickReplyDao extends PagingAndSortingRepository<DoctorQuickReply, Long> ,JpaSpecificationExecutor<DoctorQuickReply> {
    @Query("select max(q.sort) from DoctorQuickReply q where q.doctor = ?1 and q.status = 1")
    Integer findMaxSort(String doctor);
@ -30,4 +31,7 @@ public interface DoctorQuickReplyDao extends PagingAndSortingRepository<DoctorQu
    @Query("select q from DoctorQuickReply q where q.doctor = ?1 and q.status = 1")
    List<DoctorQuickReply> findDoctorReplies(String doctor, Sort sort);
    
    @Query("select q from DoctorQuickReply q where q.doctor = ?1 and q.status = 1")
    List<DoctorQuickReply> findDoctorRepliesByType(String doctor, Integer type ,Sort sort);
}

+ 4 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/followup/FollowUpDao.java

@ -23,6 +23,10 @@ public interface FollowUpDao extends PagingAndSortingRepository<Followup, Long>,
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByDoctor(String doctor, Date begin, Date end) throws Exception;
    //查询未完成有效随访记录
    @Query("select a from Followup a where a.doctorCode = ?1 and a.followupDate between ?2 and ?3 and a.status NOT IN ('0', '1') ")
    List<Followup> getByDoctor(String doctor, Date begin, Date end) throws Exception;
    @Query("select a from Followup a where a.creater = ?1 and a.followupDate between ?2 and ?3 and a.status <> '0'")
    List<Followup> findByCreater(String creater, Date begin, Date end, Pageable pageRequest) throws Exception;

+ 2 - 2
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/consult/ConsultTeamService.java

@ -2641,9 +2641,9 @@ public class ConsultTeamService extends ConsultService {
        org.json.JSONObject contentDoctor = new org.json.JSONObject();
        //医生发送的消息
        if("1".equals(type)){
            contentDoctor.put("text", "请提供您最近一次的血压检测数值及检测时间");
            contentDoctor.put("text", "请填写您近期身份异常症状问卷");
        }else{
            contentDoctor.put("text", "请提供您最近一次的血压检测数值及检测时间");
            contentDoctor.put("text", "请填写您近期体征及生活方式调查问卷");
        }
        contentDoctor.put("type",type);
        //医生发送Im消息

+ 135 - 125
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/followup/FollowUpService.java

@ -158,22 +158,22 @@ public class FollowUpService extends BaseService {
        re.put("followupTypeName", followupTypeName);
        //随访类别转译
        
        String followupClass = followup.getFollowupClass();
        re.put("followupClass", followupClass);
    
        String followupClassName = systemDictService.getDictValue("FOLLOWUP_CLASS_DICT", followup.getFollowupClass());
        if(StringUtils.isNoneBlank(followupClass) && followupClass.contains(",")){
        if (StringUtils.isNoneBlank(followupClass) && followupClass.contains(",")) {
            String[] followupClassArray = followupClass.split(",");
            followupClassName = "";
            for (int i = 0; i < followupClassArray.length; i++) {
                followupClassName += systemDictService.getDictValue("FOLLOWUP_CLASS_DICT", followupClassArray[i]);
                if(i != followupClassArray.length -1){
                    followupClassName +=",";
                if (i != followupClassArray.length - 1) {
                    followupClassName += ",";
                }
            }
        }
        
        re.put("followupClassName", followupClassName);
        //随访管理状态转译
@ -206,23 +206,23 @@ public class FollowUpService extends BaseService {
            for (Followup followup : list) {
                String date = DateUtil.dateToStrShort(followup.getFollowupDate());
                Map<String, String> map = getFollowupDetail(followup);
                if(temp.containsKey(date)){
                if (temp.containsKey(date)) {
                    Map<String, Object> vo = temp.get(date);
                    vo.put("num",Integer.parseInt(vo.get("num").toString())+1);
                    ((List<Map<String, String>>)vo.get("list")).add(map);
                    temp.put(date,vo);
                }else{
                    vo.put("num", Integer.parseInt(vo.get("num").toString()) + 1);
                    ((List<Map<String, String>>) vo.get("list")).add(map);
                    temp.put(date, vo);
                } else {
                    Map<String, Object> vo = new HashMap<>();
                    List<Map<String, String>> list1 = new ArrayList<>();
                    vo.put("date",date);
                    vo.put("num",1);
                    vo.put("date", date);
                    vo.put("num", 1);
                    list1.add(map);
                    vo.put("list",list1);
                    temp.put(date,vo);
                    vo.put("list", list1);
                    temp.put(date, vo);
                }
            }
            for (Map<String, Object> map:temp.values()){
            for (Map<String, Object> map : temp.values()) {
                re.add(map);
            }
        }
@ -237,25 +237,26 @@ public class FollowUpService extends BaseService {
     * @param teamCode
     * @param page
     * @param pageSize
     * @param type 类型:0全部,1计划,2记录
     * @param type     类型:0全部,1计划,2记录
     * @return
     */
    public JSONArray getListByPatientAndTeam(String patient, Long teamCode, int page, int pageSize, String type) {
        Sort sort = new Sort(Sort.Direction.DESC,"createTime");
        PageRequest pageRequest = new PageRequest(page, pageSize,sort);
        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        PageRequest pageRequest = new PageRequest(page, pageSize, sort);
        Page<Object> result = null;
        
        if(StringUtils.isBlank(type)){
        if (StringUtils.isBlank(type)) {
            result = followupDao.findByPatientAndTeam(patient, teamCode, pageRequest);
        }else if("1".equals(type)){
        } else if ("1".equals(type)) {
            //已经开始的就是记录
            result = followupDao.findPlanByPatientAndTeam(patient, teamCode, pageRequest);
        }else if("2".equals(type)){
        } else if ("2".equals(type)) {
            //未开始的就是计划
            result = followupDao.findRecordByPatientAndTeam(patient, teamCode, pageRequest);
        }else{}
                
        
        } else {
        }
        JSONArray array = new JSONArray();
        if (result != null && result.getContent().size() > 0) {
@ -285,10 +286,10 @@ public class FollowUpService extends BaseService {
                Object[] objArr = (Object[]) obj;
//              返回值增加居民信息
                Patient patientDetail = patientDao.findByCode(patient);
                followup.put("patientName", patientDetail.getName()!=null?patientDetail.getName():"");
                followup.put("photo", patientDetail.getPhoto()!=null?patientDetail.getPhoto():"");
                followup.put("sex", patientDetail.getSex()!=null?patientDetail.getSex():"");
                followup.put("birthday", patientDetail.getBirthday()!=null?patientDetail.getBirthday():"");
                followup.put("patientName", patientDetail.getName() != null ? patientDetail.getName() : "");
                followup.put("photo", patientDetail.getPhoto() != null ? patientDetail.getPhoto() : "");
                followup.put("sex", patientDetail.getSex() != null ? patientDetail.getSex() : "");
                followup.put("birthday", patientDetail.getBirthday() != null ? patientDetail.getBirthday() : "");
                followup.put("id", objArr[15]);
                followup.put("followupNo", objArr[16]);
@ -298,34 +299,35 @@ public class FollowUpService extends BaseService {
                followup.put("followupType", objArr[3] == null ? "" : objArr[3]);
                followup.put("followupTypeName", objArr[3] == null ? "" : (dictMap.get(objArr[3].toString()) != null ? dictMap.get(objArr[3].toString()) : ""));
                followup.put("followupClass", objArr[4] == null ? "" : objArr[4]);
    
//                followup.put("followupClassName", objArr[4] == null ? "" : (objArr[4].toString().equals("1") ? "高血压" : "糖尿病"));
               
                if( objArr[4] == null){
                if (objArr[4] == null) {
                    followup.put("followupClassName", "");
                }else{
                    if(objArr[4].toString().equals("1")){
                } else {
                    if (objArr[4].toString().equals("1")) {
                        followup.put("followupClassName", "高血压");
                    }else if(objArr[4].toString().equals("2")){
                    } else if (objArr[4].toString().equals("2")) {
                        followup.put("followupClassName", "糖尿病");
                    }else if(objArr[4].toString().equals("3")){
                    } else if (objArr[4].toString().equals("3")) {
                        followup.put("followupClassName", "高血压,糖尿病");
                    }else{}
                    } else {
                    }
                }
                
                
                followup.put("status", objArr[5] == null ? "" : objArr[5]);
                followup.put("statusName", objArr[5] == null ? "" : (statusMap.get(objArr[5].toString()) != null ? statusMap.get(objArr[5].toString()) : ""));
                followup.put("createTime", objArr[6] != null ? DateUtil.dateToStrLong((Date)objArr[6]) : "");
                followup.put("updateTime", objArr[7] != null ? DateUtil.dateToStrLong((Date)objArr[7]) : "");
                followup.put("createTime", objArr[6] != null ? DateUtil.dateToStrLong((Date) objArr[6]) : "");
                followup.put("updateTime", objArr[7] != null ? DateUtil.dateToStrLong((Date) objArr[7]) : "");
                followup.put("followupManagerStatus", objArr[8] == null ? "" : objArr[8]);
                followup.put("followupManagerStatusName", objArr[8] == null ? "" : (mngStatusMap.get(objArr[8].toString()) != null ? mngStatusMap.get(objArr[8].toString()) : ""));
                followup.put("creatorCode", objArr[9]);
                followup.put("creatorName", objArr[10]);
                followup.put("creatorPhoto", objArr[11]);
                followup.put("followupDate", objArr[12] != null ? DateUtil.dateToStrLong((Date)objArr[12]) : "");
                followup.put("followupPlanDate", objArr[13] != null ? DateUtil.dateToStrLong((Date)objArr[13]) : "");
                followup.put("followupNextDate", objArr[14] != null ? DateUtil.dateToStrLong((Date)objArr[14]) : "");
                followup.put("followupDate", objArr[12] != null ? DateUtil.dateToStrLong((Date) objArr[12]) : "");
                followup.put("followupPlanDate", objArr[13] != null ? DateUtil.dateToStrLong((Date) objArr[13]) : "");
                followup.put("followupNextDate", objArr[14] != null ? DateUtil.dateToStrLong((Date) objArr[14]) : "");
                array.put(followup);
            }
        }
@ -373,7 +375,7 @@ public class FollowUpService extends BaseService {
            SignFamily signFamily = signFamilyDao.findByjiatingPatient(patientCode);
            if (signFamily == null) {
                signFamily = signFamilyDao.findBySanshiPatient(patientCode);
                if(signFamily==null){
                if (signFamily == null) {
                    throw new Exception("can not find patient's family sign info");
                }
            }
@ -438,12 +440,12 @@ public class FollowUpService extends BaseService {
    /**
     * 开始随访记录
     */
    public void startFollowup(String id, String date, String followupType, String followupClass, String followupManagerStatus,String plandate,String prescriptioncode) throws Exception {
    public void startFollowup(String id, String date, String followupType, String followupClass, String followupManagerStatus, String plandate, String prescriptioncode) throws Exception {
        Followup followup = followupDao.findOne(Long.valueOf(id));
        if (followup != null) {
            followup.setFollowupDate(DateUtil.strToDate(date));
            //计划下次随访时间--huangwenjie.2017.10.19
            if(StringUtils.isNoneBlank(plandate)){
            if (StringUtils.isNoneBlank(plandate)) {
                followup.setFollowupNextDate(DateUtil.strToDate(plandate));
                Followup nextFollowup = new Followup();
                nextFollowup.setDataFrom(followup.getDataFrom());
@ -470,7 +472,7 @@ public class FollowUpService extends BaseService {
                nextFollowup.setIdcard(followup.getIdcard());
                nextFollowup.setSignType(followup.getSignType());
                followupDao.save(nextFollowup);
                
            }
            followup.setFollowupType(followupType);
            followup.setFollowupClass(followupClass);
@ -487,7 +489,7 @@ public class FollowUpService extends BaseService {
    /**
     * 新增临时随访记录(返回ID)
     */
    public String addFollowup(String doctorCode, String patientCode, String date, String followupType, String followupClass, String followupManagerStatus,String plandate,String prescriptioncode) throws Exception {
    public String addFollowup(String doctorCode, String patientCode, String date, String followupType, String followupClass, String followupManagerStatus, String plandate, String prescriptioncode) throws Exception {
        String re = "";
        //获取医生信息
@ -504,8 +506,8 @@ public class FollowUpService extends BaseService {
        SignFamily signFamily = signFamilyDao.findByjiatingPatient(patientCode);
        if (signFamily == null) {
            signFamily = signFamilyDao.findBySanshiPatient(patientCode);
            if(signFamily==null)
               throw new Exception("can not find patient's family sign info");
            if (signFamily == null)
                throw new Exception("can not find patient's family sign info");
        }
        Followup followup = new Followup();
@ -530,14 +532,14 @@ public class FollowUpService extends BaseService {
        followup.setSignType(2);
        //保存质询code
        followup.setSignCode(patientService.getSignCodeByPatient(patientCode));
        
        //如果有填入续方CODE,则添加续方关联--huangwenjie.2017.11.02
        if(StringUtils.isNotBlank(prescriptioncode)){
        if (StringUtils.isNotBlank(prescriptioncode)) {
            followup.setPrescriptionCode(prescriptioncode);
        }
        //计划下次随访时间--ysj.2017.10.26
        if(StringUtils.isNoneBlank(plandate)){
        if (StringUtils.isNoneBlank(plandate)) {
            followup.setFollowupNextDate(DateUtil.strToDate(plandate));
            Followup nextFollowup = new Followup();
            nextFollowup.setDataFrom(followup.getDataFrom());
@ -593,22 +595,22 @@ public class FollowUpService extends BaseService {
        if (followup != null) {
            followup.setStatus("1");  //状态 0取消 1已完成 2未开始 3进行中
            followup = followupDao.save(followup);
    
            //上传随访计划映射表记录
            FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(String.valueOf(followup.getId())));
            
            if(followupMapping == null){
            if (followupMapping == null) {
                followupMapping = new FollowupMapping();
            }
    
            followupMapping.setFollowupId(Integer.parseInt(String.valueOf(followup.getId())));
            followupMapping.setCode(UUID.randomUUID().toString());
            followupMapping.setCreateTime(DateUtil.getNowTimestamp());
            followupMapping.setUpdateTime(DateUtil.getNowTimestamp());
            followupMapping.setNeedUpload(1);
            
            followUpMappingDao.save(followupMapping);
           
//            new Thread(new FollowupUploadTask(String.valueOf(followup.getId()))).start();
        } else {
            throw new Exception("not exit follow:" + id + ".\r\n");
@ -697,13 +699,13 @@ public class FollowUpService extends BaseService {
            followupContentDao.save(newList);
        }
    
        Followup followup = followupDao.findOne(Long.valueOf(id));
    
        //如果该随访是已完成的,则添加随访信息上传映射,上传到基卫
        if("1".equals(followup.getStatus())){
        if ("1".equals(followup.getStatus())) {
            FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(id));
            if(followupMapping == null){
            if (followupMapping == null) {
                followupMapping = new FollowupMapping();
                followupMapping.setCode(UUID.randomUUID().toString());
                followupMapping.setFollowupId(Integer.parseInt(id));
@ -861,7 +863,10 @@ public class FollowUpService extends BaseService {
                    // 推送消息给医生
                    pushMsgTask.put(doctor, "4", title, content, "");
                    //            新增发送医生助手模板消息 v1.4.0 by wujunjie
                    SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                    List<Followup> followups = followupDao.getByDoctor(doctor, format.parse(start), format.parse(end));
                    Doctor doctor1 = doctorDao.findByCode(doctor);
                    String doctorOpenID = doctor1.getOpenid();
                    if (StringUtils.isNotEmpty(doctorOpenID)) {
@ -872,8 +877,8 @@ public class FollowUpService extends BaseService {
                        params.add(new BasicNameValuePair("url", targetUrl));
                        params.add(new BasicNameValuePair("first", "您今日有1个随访计划待处理"));
                        params.add(new BasicNameValuePair("remark", ""));
                        SimpleDateFormat format = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                        String newDate = format.format(new Date());
                        SimpleDateFormat formatDate = new SimpleDateFormat("yyyy年MM月dd日 HH:mm");
                        String newDate = formatDate.format(new Date());
                        String keywords = "patientName" + newDate + "," + "请进入手机APP查看";
                        params.add(new BasicNameValuePair("keywords", keywords));
@ -889,15 +894,16 @@ public class FollowUpService extends BaseService {
            e.printStackTrace();
        }
    }
    
    /**
     *ES 保存随访记录详情
     *@author huangwenjie
     *@date 2017/11/1 14:57
     * ES 保存随访记录详情
     *
     * @author huangwenjie
     * @date 2017/11/1 14:57
     */
    @Transactional
    public void esSaveFollowupProjectData(String id, String followupProject, String followupProjectData) throws Exception {
        
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -906,33 +912,33 @@ public class FollowUpService extends BaseService {
                        .must(QueryBuilders.matchQuery("followup_id", id))
                        .must(QueryBuilders.matchQuery("followup_project", followupProject))
        );
    
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
        List<FollowupContentESDO> dataList = result.getSourceAsObjectList(FollowupContentESDO.class);
        
        //删除原有记录
        this.esDeleteFollowUpContent(dataList);
        
        //保存新的随访详情信息
        List<FollowupContentESDO> newdatalist = new ArrayList<>();
        FollowupContentESDO followupContentESDO = new FollowupContentESDO();
    
        followupContentESDO = JSON.parseObject(followupProjectData,FollowupContentESDO.class);
    
        followupContentESDO = JSON.parseObject(followupProjectData, FollowupContentESDO.class);
        followupContentESDO.setFollowup_id(id);
        followupContentESDO.setFollowup_project(followupProject);
        followupContentESDO.setCreate_time(new Date());
        newdatalist.add(followupContentESDO);
        elastricSearchSave.save(newdatalist,esIndex,esType);
        
        
        elastricSearchSave.save(newdatalist, esIndex, esType);
        //如果该随访是已完成的,则添加随访信息上传映射,上传到基卫
        Followup followup = followupDao.findOne(Long.valueOf(id));
        if("1".equals(followup.getStatus())){
        if ("1".equals(followup.getStatus())) {
            FollowupMapping followupMapping = followUpMappingDao.findByFollowupId(Integer.parseInt(id));
            if(followupMapping == null){
            if (followupMapping == null) {
                followupMapping = new FollowupMapping();
                followupMapping.setCode(UUID.randomUUID().toString());
                followupMapping.setFollowupId(Integer.parseInt(id));
@ -943,13 +949,13 @@ public class FollowUpService extends BaseService {
            followUpMappingDao.save(followupMapping);
        }
    }
    
    /**
     * ES获取面访项目数据
     */
    public FollowupContentESDO esGetFollowupProjectData(String id, String followupProject) throws Exception {
        //根据随访ID、分类ID获取随访记录详情
    
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -958,20 +964,21 @@ public class FollowUpService extends BaseService {
                        .must(QueryBuilders.matchQuery("followup_id", id))
                        .must(QueryBuilders.matchQuery("followup_project", followupProject))
        );
    
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
        FollowupContentESDO followupContentESDO  = result.getSourceAsObject(FollowupContentESDO.class);
        FollowupContentESDO followupContentESDO = result.getSourceAsObject(FollowupContentESDO.class);
        return followupContentESDO;
    }
    
    /**
     *ES 删除随访详情信息
     *@author huangwenjie
     *@date 2017/11/1 15:17
     * ES 删除随访详情信息
     *
     * @author huangwenjie
     * @date 2017/11/1 15:17
     */
    public void esDeleteFollowUpContent(List<FollowupContentESDO> datalist) throws Exception{
    public void esDeleteFollowUpContent(List<FollowupContentESDO> datalist) throws Exception {
        try {
            JestClient jestClient = elasticFactory.getJestClient();
            //根据id批量删除
@ -981,25 +988,26 @@ public class FollowUpService extends BaseService {
                bulk.addAction(index);
            }
            BulkResult br = jestClient.execute(bulk.build());
    
            logger.info("delete data count:" + datalist.size());
            logger.info("delete flag:" + br.isSucceeded());
        }catch (Exception e){
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    
    /**
     * ES获取面访项目数据列表
     *@author huangwenjie
     *@date 2017/11/1 19:41
     *
     * @author huangwenjie
     * @date 2017/11/1 19:41
     */
    public List<String>  esfindProjectByFollowupId(String id) throws Exception {
    public List<String> esfindProjectByFollowupId(String id) throws Exception {
        //根据随访ID、分类ID获取随访记录详情
        
        List<String> resultList = new ArrayList<>();
        
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -1007,33 +1015,34 @@ public class FollowUpService extends BaseService {
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
        );
        
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
    
        List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
        
        followupContentESDOList  = result.getSourceAsObjectList(FollowupContentESDO.class);
        if(!followupContentESDOList.isEmpty()){
            for (FollowupContentESDO followupContentESDO: followupContentESDOList) {
        followupContentESDOList = result.getSourceAsObjectList(FollowupContentESDO.class);
        if (!followupContentESDOList.isEmpty()) {
            for (FollowupContentESDO followupContentESDO : followupContentESDOList) {
                resultList.add(followupContentESDO.getFollowup_project());
            }
        }
        
        return resultList;
    }
    
    /**
     * ES获取面访项目数据详情
     *@author huangwenjie
     *@date 2017/11/1 19:41
     *
     * @author huangwenjie
     * @date 2017/11/1 19:41
     */
    public List<FollowupContentESDO>  esfindFollowUpContestsByFollowupId(String id) throws Exception {
    public List<FollowupContentESDO> esfindFollowUpContestsByFollowupId(String id) throws Exception {
        //根据随访ID、分类ID获取随访记录详情
        
        List<String> resultList = new ArrayList<>();
        
        JestClient jestClient = elasticFactory.getJestClient();
        //先根据条件查找出来
        SearchSourceBuilder searchSourceBuilder = new SearchSourceBuilder();
@ -1041,29 +1050,30 @@ public class FollowUpService extends BaseService {
                new BoolQueryBuilder()
                        .must(QueryBuilders.matchQuery("followup_id", id))
        );
        
        Search search = new Search.Builder(searchSourceBuilder.toString()).addIndex(esIndex).addType(esType)
                .build();
        SearchResult result = jestClient.execute(search);
        
        List<FollowupContentESDO> followupContentESDOList = new ArrayList<>();
        
        return followupContentESDOList;
    }
    
    /**
     * 根据续方CODE获取随访记录信息
     * @param prescriptionCode
     * @return
     */
    public String getFollowupByPrescriptionCode(String prescriptionCode) {
        Followup followup = followupDao.getFollowupByPrescriptionCode(prescriptionCode);
    
        String jsonString = JSON.toJSONString(followup);
        
        return jsonString;
    }
    
    /**
     * 获取随访详情记录分类记录数
     * @param followupid
@ -1071,7 +1081,7 @@ public class FollowUpService extends BaseService {
     * @return
     */
    public int getfollowupcontent(String followupid, String type) throws Exception {
    
        int count = 0;
        String[] typelist = null;
        if(type.contains(",")){
@ -1079,15 +1089,15 @@ public class FollowUpService extends BaseService {
        }else{
            typelist = new String[]{type};
        }
    
        for (String typekey: typelist) {
            if(!"drug".equals(type)){
    
                FollowupContentESDO followupContentESDO = this.esGetFollowupProjectData(followupid,typekey);
                if(followupContentESDO != null){
                    count ++;
                }
            
            }else{
                //获取用药记录
                List<FollowupDrugs> drugsList = followupDrugsDao.findByFollowupId(Long.valueOf(followupid));
@ -1096,7 +1106,7 @@ public class FollowUpService extends BaseService {
                }
            }
        }
        
        return count;
    }

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

@ -19,7 +19,6 @@ import com.yihu.wlyy.service.app.health.PatientHealthIndexService;
import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.ImUtill;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
@ -306,6 +305,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				//医生发送的消息
				contentDoctor.put("text", "请提供您最近一次的血糖检测数值及检测时间");
				contentDoctor.put("needupload",false);
				contentDoctor.put("type",2);
				int total = 0;
				String sql = "select sum(category_code) amount deviceType FROM wlyy_patient_device WHERE user="+prescription.getPatient();
				List<Map<String,Object>> result =  jdbcTemplate.queryForList(sql);
@ -323,7 +323,8 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("title", "【本消息为系统提醒】:");
				contentPatient.put("tzMsg", "体征记录:血糖"+imBloodSugarValue);
				contentPatient.put("tzTime", "检测时间:"+imBloodSugarDate);
				contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以自动填入本次随访记录");
				contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
				contentPatient.put("type",2);
				
				//患者发送Im消息
				ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
@ -334,6 +335,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				//医生发送的消息
				contentDoctor.put("text", "居民近30天未上传血糖体征数据,已通知居民上传数据,请耐心等待");
				contentDoctor.put("needupload",true);
				contentDoctor.put("type",2);
			}else{
				throw new Exception("未找到30天内的血糖记录!");
			}
@ -382,6 +384,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				//医生发送的消息
				contentDoctor.put("text", "请提供您最近一次的血压检测数值及检测时间");
				contentDoctor.put("needUpload",false);
				contentDoctor.put("type",1);
				
				int total = 0;
				String sql = "select sum(category_code) amount deviceType FROM wlyy_patient_device WHERE user="+prescription.getPatient();
@ -400,7 +403,8 @@ public class PrescriptionFollowupContentService extends BaseService {
				contentPatient.put("title", "【本消息为系统提醒】:");
				contentPatient.put("tzMsg", "体征记录:血压"+jsonObject.getString("value1")+"/"+jsonObject.getString("value2")+" mmHg");
				contentPatient.put("tzTime", "检测时间:"+jsonObject.getString("date"));
				contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以自动填入本次随访记录");
				contentPatient.put("tzAlert","温馨提示:本条体征为居民上传的健康体征数据,您可以");
				contentPatient.put("type",1);
				
				//患者发送Im消息
				ImUtill.sendTopicIM(prescription.getPatient(), prescription.getPatientName(), prescription.getConsult(), "16", contentPatient.toString(), null);
@ -411,6 +415,7 @@ public class PrescriptionFollowupContentService extends BaseService {
				//医生发送的消息
				contentDoctor.put("text", "居民近30天未上传血压体征数据,已通知居民上传数据,请耐心等待");
				contentDoctor.put("needupload",true);
				contentDoctor.put("type",1);
			}else{
				throw new Exception("未找到30天内的血压记录!");
			}

+ 21 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/reply/DoctorQuickReplyService.java

@ -3,6 +3,7 @@ package com.yihu.wlyy.service.app.reply;
import com.yihu.wlyy.entity.doctor.reply.DoctorQuickReply;
import com.yihu.wlyy.repository.doctor.DoctorQuickReplyDao;
import com.yihu.wlyy.service.BaseService;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
@ -10,6 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.print.Doc;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@ -29,7 +31,7 @@ public class DoctorQuickReplyService extends BaseService {
     * @param content 快捷回复内容
     * @return
     */
    public DoctorQuickReply addReply(String doctor, String content) {
    public DoctorQuickReply addReply(String doctor, String content,String type) {
        DoctorQuickReply reply = new DoctorQuickReply();
        Integer sort = quickReplyDao.findMaxSort(doctor);
        sort = sort == null ? 1 : sort + 1;
@ -38,6 +40,7 @@ public class DoctorQuickReplyService extends BaseService {
        reply.setStatus(1);
        reply.setSort(sort);
        reply.setUpdateTime(new Date());
        reply.setType(Integer.parseInt(type));
        return quickReplyDao.save(reply);
    }
@ -49,7 +52,7 @@ public class DoctorQuickReplyService extends BaseService {
     * @param content 快捷回复内容
     * @return
     */
    public DoctorQuickReply modifyReply(long id, String content) throws Exception {
    public DoctorQuickReply modifyReply(long id, String content,String type) throws Exception {
        DoctorQuickReply reply = quickReplyDao.findOne(id);
        if (reply == null) {
@ -57,6 +60,7 @@ public class DoctorQuickReplyService extends BaseService {
        }
        reply.setContent(content);
        reply.setType(Integer.parseInt(type));
        return quickReplyDao.save(reply);
    }
@ -91,9 +95,22 @@ public class DoctorQuickReplyService extends BaseService {
     * @param doctor
     * @return
     */
    public List<DoctorQuickReply> getDoctorReplyList(String doctor) {
    public List<DoctorQuickReply> getDoctorReplyList(String doctor,String type) {
        Sort sort = new Sort(Sort.Direction.DESC, "sort");
        List<DoctorQuickReply> replies = quickReplyDao.findDoctorReplies(doctor, sort);
        List<DoctorQuickReply> replies = quickReplyDao.findDoctorRepliesByType(doctor, Integer.parseInt(type),sort);
        
        if("1".equals(type)){
            //如果是续方咨询,拿到的列表为空,则默认添加系统消息
            List<DoctorQuickReply> defaults = quickReplyDao.findDoctorReplies("default",sort);
            for (DoctorQuickReply doctorQuickReply:defaults) {
                doctorQuickReply.setId(null);
                doctorQuickReply.setDoctor(doctor);
            }
            quickReplyDao.save(defaults);
    
            replies = quickReplyDao.findDoctorRepliesByType(doctor, Integer.parseInt(type),sort);
        }
        
        return replies;
    }

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

@ -839,7 +839,7 @@ public class StatisticsESService {
                    resultList.add(obj);
                }
            }
        } else if (SaveModel.townLevel.equals(lowLevel)) {
        } else if (lowLevel.equals("4")) {
            List<Town> towns = new ArrayList<>();
            if (SaveModel.cityLevel.equals(level+"")) {
                towns = townDao.findByCityCode(area);
@ -868,7 +868,7 @@ public class StatisticsESService {
            }
        } else if (SaveModel.teamLevel.equals(lowLevel)) {
            List<Hospital> hospitals = new ArrayList<>();
            if (SaveModel.cityLevel.equals(level+"")) {
            if (level == 2) {
                hospitals = hospitalDao.findByCity(area);
            } else if (SaveModel.townLevel.equals(level+"")) {
                hospitals = hospitalDao.findByTownCode(area);
@ -902,22 +902,23 @@ public class StatisticsESService {
    public JSONArray getLevelTwoLowLevelTotalTeamLeader(String date, String area, int level, String index, int sort, String lowLevel, String lowCode, String year) throws Exception {
//        String low_level = String.valueOf(org.springframework.util.StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String low_level = String.valueOf(org.springframework.util.StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();
        List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel1(date, area, level, index, SaveModel.timeLevel_DDL, lowLevel, lowCode);
        List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel1(date, area, level, index, SaveModel.timeLevel_DDL, low_level, lowCode);
        if (esModelList != null && esModelList.size() > 0) {
            for (SaveModel one : esModelList) {
                Map<String, Object> maps = new HashMap<String, Object>();
                maps.put("amount", one.getResult1());
                if (SaveModel.townLevel.equals(lowLevel)) {
                maps.put("amount", one.getResult1().intValue());
                if (low_level.equals("3")) {
                    maps.put("code", one.getTown());
                    maps.put("name", one.getTownName());
                } else if (SaveModel.OrgLevel.equals(lowLevel)) {
                } else if (low_level.equals("4")) {
                    maps.put("code", one.getHospital());
                    maps.put("name", one.getHospitalName());
                } else if (SaveModel.teamLevel.equals(lowLevel)) {
                } else if (low_level.equals("5")) {
                    maps.put("code", one.getTeam());
                    maps.put("name", one.getTeamName());
                }
@ -926,7 +927,7 @@ public class StatisticsESService {
        }
        // 结果为空时,自建结果集
        if (resultList == null || resultList.size() < 1) {
            resultList = getLowLevelMapKey(level, lowCode, area);
            resultList = getLowLevelMapKey(level, low_level, area);
        }
        if (resultList != null) {
@ -937,7 +938,7 @@ public class StatisticsESService {
                map.put("amount", map.get("amount") != null ? Long.valueOf(map.get("amount").toString()) : 0L);
                map.put("signTaskNum", signTaskNum);//目标量
                map.put("signRegulationNum", signRegulationNum);//调控量
                if (!SaveModel.teamLevel.equals(lowLevel)) {
                if (!low_level.equals("5")) {
                    PopulationBase peopleNum = getPopulationBase(map.get("code").toString(), year);
                    if (peopleNum != null) {
                        int num = 0;
@ -946,10 +947,10 @@ public class StatisticsESService {
                        if (lowCode.equals("3")) {
                            num = peopleNum.getSixFiveNum();
                            taskNum = peopleNum.getSixFiveTaskNum();
                        } else if (lowCode.equals("1")) {
                        } else if (lowCode.equals("5")) {
                            num = peopleNum.getGxyNum();
                            taskNum = peopleNum.getGxyTaskNum();
                        } else if (lowCode.equals("2")) {
                        } else if (lowCode.equals("4")) {
                            num = peopleNum.getTnbNum();
                            taskNum = peopleNum.getTnbTaskNum();
                        }
@ -964,7 +965,7 @@ public class StatisticsESService {
                    }
                }
            }
            if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) {
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
                translateTeamLeaderName(resultList);
            }
@ -1100,7 +1101,7 @@ public class StatisticsESService {
     */
    public JSONArray getLevelTwoLowLevelTotal(String date, String area, int level, String index, int sort, String lowLevel, String lowCode, String year) throws Exception {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String low_level = String.valueOf(org.springframework.util.StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        String low_level = String.valueOf(org.springframework.util.StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();
        List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel1(date, area, level, index, SaveModel.timeLevel_DDL, lowLevel, lowCode);
@ -1112,10 +1113,10 @@ public class StatisticsESService {
                if (low_level.equals("3")) {
                    maps.put("code", one.getTown());
                    maps.put("name", one.getTownName());
                } else if (low_level.equals("2")) {
                } else if (low_level.equals("4")) {
                    maps.put("code", one.getHospital());
                    maps.put("name", one.getHospitalName());
                } else if (low_level.equals("1")) {
                } else if (low_level.equals("5")) {
                    maps.put("code", one.getTeam());
                    maps.put("name", one.getTeamName());
                }
@ -1133,7 +1134,7 @@ public class StatisticsESService {
            for (Map<String, Object> map : resultList) {
                map.put("amount", map.get("amount") != null ? Long.valueOf(map.get("amount").toString()) : 0L);
                if (!low_level.equals("1")) {
                if (!low_level.equals("5")) {
                    PopulationBase peopleNum = getPopulationBase(area, year);
                    if (peopleNum != null) {
                        int num = 0;
@ -1142,10 +1143,10 @@ public class StatisticsESService {
                        if (lowCode.equals("3")) {
                            num = peopleNum.getSixFiveNum();
                            taskNum = peopleNum.getSixFiveTaskNum();
                        } else if (lowCode.equals("1")) {
                        } else if (lowCode.equals("5")) {
                            num = peopleNum.getGxyNum();
                            taskNum = peopleNum.getGxyTaskNum();
                        } else if (lowCode.equals("2")) {
                        } else if (lowCode.equals("4")) {
                            num = peopleNum.getTnbNum();
                            taskNum = peopleNum.getTnbTaskNum();
                        }
@ -1161,7 +1162,7 @@ public class StatisticsESService {
                }
            }
            if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) {
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
                translateTeamLeaderName(resultList);
            }
@ -1200,7 +1201,7 @@ public class StatisticsESService {
     */
    public JSONArray getLowLevelTotal2(String date, String area, int level, String index, int sort, String lowLevel) throws Exception {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String low_level = String.valueOf(org.springframework.util.StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        String low_level = String.valueOf(org.springframework.util.StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();
        //获取微信关注的未交费
        Map<String, Integer> expenseStatus0 = getByIndex(date, area, level, "49", sort, lowLevel, dateFormat);
@ -1241,7 +1242,7 @@ public class StatisticsESService {
                map.put("bindRate", getRangeDouuble(expenseStatus1amountNum, expenseStatus1SigjnNum, 2));//微信关注率
            }
            if ((level == 4 && "1".equals(lowLevel)) || (level == 2)) {
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4)) {
                translateTeamLeaderName(resultList);
            }
            //  排序 按绑定率来排序
@ -1308,11 +1309,11 @@ public class StatisticsESService {
        List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(date, area, level, index, SaveModel.timeLevel_DDL, lowLevel);
        if (esModelList != null && esModelList.size() > 0) {
            esModelList.stream().forEach(one -> {
                if (SaveModel.townLevel.equals(lowLevel)) {
                if (lowLevel.equals("3")) {
                    returnMap.put(one.getTown(), one.getResult1().intValue());
                } else if (SaveModel.OrgLevel.equals(lowLevel)) {
                } else if (lowLevel.equals("4")) {
                    returnMap.put(one.getHospital(), one.getResult1().intValue());
                } else if (SaveModel.teamLevel.equals(lowLevel)) {
                } else if (lowLevel.equals("5")) {
                    returnMap.put(one.getTeam(),one.getResult1().intValue());
                }
            });
@ -1325,7 +1326,7 @@ public class StatisticsESService {
        JSONObject returnJo = new JSONObject();
        JSONArray ja = new JSONArray();
        //市级
        if (level == 4) {
        if (level == 2) {
            if (StringUtils.isBlank(lowLevel)) {
                List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(DateUtil.dateToStrShort(new Date()), area, level, "28", SaveModel.timeLevel_DDL, "3");
                esModelList.forEach(one -> {
@ -1354,7 +1355,7 @@ public class StatisticsESService {
                jo.put("avgCount", getRangeDouuble(one.getResult1(), one.getResult2().intValue(), 2));
                ja.put(jo);
            });
        } else if (level == 2) {
        } else if (level == 4) {
            List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(DateUtil.dateToStrShort(new Date()), area, level, "28", SaveModel.timeLevel_DDL, "1");
            esModelList.forEach(one -> {
@ -1385,22 +1386,22 @@ public class StatisticsESService {
     */
    public JSONArray getLowLevelTotalTeamLeader(String date, String area, int level, String index, int sort, String lowLevel, String year) throws Exception {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String low_level = String.valueOf(org.springframework.util.StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        String low_level = String.valueOf(org.springframework.util.StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();
        List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(date, area, level, index, SaveModel.timeLevel_DDL, lowLevel);
        List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(date, area, level, index, SaveModel.timeLevel_DDL, low_level);
        if (esModelList != null && esModelList.size() > 0) {
            for (SaveModel one : esModelList) {
                Map<String, Object> maps = new HashMap<String, Object>();
                maps.put("amount", one.getResult2().intValue());
                if (SaveModel.townLevel.equals(low_level)) {
                if (low_level.equals("3") && one.getTown()!=null) {
                    maps.put("code", one.getTown());
                    maps.put("name", one.getTownName());
                } else if (SaveModel.OrgLevel.equals(low_level)) {
                } else if (low_level.equals("4") && one.getHospital()!=null) {
                    maps.put("code", one.getHospital());
                    maps.put("name", one.getHospitalName());
                } else if (SaveModel.teamLevel.equals(low_level)) {
                } else if (low_level.equals("5") && one.getTeam()!=null) {
                    maps.put("code", one.getTeam());
                    maps.put("name", one.getTeamName());
                }
@ -1423,7 +1424,7 @@ public class StatisticsESService {
                map.put("signTaskNum", signTaskNum);//目标量
                map.put("signRegulationNum", signRegulationNum);//调控量
                if (!SaveModel.teamLevel.equals(low_level)) {
                if (!low_level.equals("5")) {
                    String code = map.get("code").toString();
                    PopulationBase peopleNum = getPopulationBase(code, year);
                    if (peopleNum != null) {
@ -1439,7 +1440,7 @@ public class StatisticsESService {
                }
            }
            if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) {
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
                translateTeamLeaderName(resultList);
            }
@ -1479,10 +1480,10 @@ public class StatisticsESService {
     */
    public JSONArray getLowLevelTotal(String date, String area, int level, String index, int sort, String lowLevel, String year) throws Exception {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
        String low_level = String.valueOf(org.springframework.util.StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        String low_level = String.valueOf(org.springframework.util.StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();
        List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(date, area, level, index, SaveModel.timeLevel_DDL, lowLevel);
        List<SaveModel> esModelList = (List<SaveModel>) elasticsearchUtil.findListDateQuotaLevel0(date, area, level, index, SaveModel.timeLevel_DDL, low_level);
        if (esModelList != null && esModelList.size() > 0) {
            for (SaveModel one : esModelList) {
@ -1491,10 +1492,10 @@ public class StatisticsESService {
                if (low_level.equals("3")) {
                    maps.put("code", one.getTown());
                    maps.put("name", one.getTownName());
                } else if (low_level.equals("2")) {
                } else if (low_level.equals("4")) {
                    maps.put("code", one.getHospital());
                    maps.put("name", one.getHospitalName());
                } else if (low_level.equals("1")) {
                } else if (low_level.equals("5")) {
                    maps.put("code", one.getTeam());
                    maps.put("name", one.getTeamName());
                }
@ -1512,7 +1513,7 @@ public class StatisticsESService {
            for (Map<String, Object> map : resultList) {
                map.put("amount", map.get("amount") != null ? Long.valueOf(map.get("amount").toString()) : 0L);
                if (!low_level.equals("1")) {
                if (!low_level.equals("5")) {
                    PopulationBase peopleNum = getPopulationBase(area, year);
                    if (peopleNum != null) {
                        map.put("rate", df.format(((long) map.get("amount") * 1.0000) / peopleNum.getNum() * 100));
@ -1527,7 +1528,7 @@ public class StatisticsESService {
                }
            }
            if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) {
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
                translateTeamLeaderName(resultList);
            }
@ -1573,10 +1574,10 @@ public class StatisticsESService {
                if (SaveModel.townLevel.equals(low_level)) {
                    maps.put("code", one.getTown());
                    maps.put("name", one.getTownName());
                } else if (SaveModel.OrgLevel.equals(low_level)) {
                } else if (low_level.equals("4")) {
                    maps.put("code", one.getHospital());
                    maps.put("name", one.getHospitalName());
                } else if (SaveModel.teamLevel.equals(low_level)) {
                } else if (low_level.equals("5")) {
                    maps.put("code", one.getTeam());
                    maps.put("name", one.getTeamName());
                }
@ -1599,11 +1600,11 @@ public class StatisticsESService {
                        resultList.add(obj);
                    }
                }
            } else if (SaveModel.OrgLevel.equals(low_level)) {
            } else if (low_level.equals("4")) {
                List<Town> towns = new ArrayList<>();
                if (SaveModel.cityLevel.equals(level+"")) {
                if (level == 2) {
                    towns = townDao.findByCityCode(area);
                } else if (SaveModel.townLevel.equals(level+"")) {
                } else if (level == 3) {
                    Town town = townDao.findByCode(area);
                    towns.add(town);
                }
@ -1621,11 +1622,11 @@ public class StatisticsESService {
                        }
                    }
                }
            } else if (SaveModel.teamLevel.equals(low_level)) {
            } else if (low_level.equals("5")) {
                List<Hospital> hospitals = new ArrayList<>();
                if (SaveModel.cityLevel.equals(level+"")) {
                if (level == 2) {
                    hospitals = hospitalDao.findByCity(area);
                } else if (SaveModel.OrgLevel.equals(level+"")) {
                } else if (level == 3) {
                    hospitals = hospitalDao.findByTownCode(area);
                } else {
                    Hospital hos = hospitalDao.findByCode(area);
@ -2009,7 +2010,7 @@ public class StatisticsESService {
        JSONObject jo = new JSONObject();
        String switchIndex = "";//转签index
        String signIndex ="1";//签约index
        String renewIndex =index;//续签index..
        String renewIndex =index;//续签index.
        String date = year + "-06-30";
        try{
            if (level == 4) {
@ -2278,28 +2279,29 @@ public class StatisticsESService {
    public JSONArray getLevelTwoLowLevelTotalSignAndRenew(String area, int level, String index, int sort, String lowLevel, String year, String lowCode) throws Exception {
        String lastDate = year + "-06-30";
        //String timeKey = elasticsearchUtil.getQuotaTime();
        String timeKey = elasticsearchUtil.getQuotaTime();
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level - 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();//续签量
        Map<String, Integer> renewMap = new HashMap<>(); //续签的的列表转map
        List<SaveModel> renewSaveModels = new ArrayList<SaveModel>();
        List<SaveModel> signSaveModels = new ArrayList<SaveModel>();
        if (StringUtils.isEmpty(lowCode)) {
            //续签量
            renewSaveModels = elasticsearchUtil.findListDateQuotaLevel0(lastDate, area, level, index, "2", lowLevel);
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel0(timeKey,timeKey, area, level, index, "2", "",lowLevel);
        } else {
            //续签量
            renewSaveModels = elasticsearchUtil.findListDateQuotaLevel1(lastDate, area, level, index, "2", lowLevel, lowCode);
            renewSaveModels = elasticsearchUtil.findDateQuotaLevel1(timeKey,timeKey, area, level, index,"2",lowCode,"",low_level);
        }
        if (renewSaveModels != null && renewSaveModels.size() > 0) {
            for (SaveModel saveModel : renewSaveModels) {
                if ("3".equals(low_level)) {
                if ("3".equals(low_level) && saveModel.getTown()!=null) {
                    renewMap.put(saveModel.getTown(), saveModel.getResult2().intValue());
                } else if ("4".equals(low_level)) {
                } else if ("4".equals(low_level) && saveModel.getHospital()!=null) {
                    renewMap.put(saveModel.getHospital(), saveModel.getResult2().intValue());
                } else if ("5".equals(low_level)) {
                } else if ("5".equals(low_level) && saveModel.getTeam()!=null) {
                    renewMap.put(saveModel.getTeam(), saveModel.getResult2().intValue());
                } else {
                    continue;
@ -2310,7 +2312,7 @@ public class StatisticsESService {
        //自建结果集
        resultList = getLowLevelMapKey(level, low_level, area);
        if (resultList != null) {
        if (resultList != null && resultList.size()>0) {
            DecimalFormat df = new DecimalFormat("0.0000");
            //查询去年的签约转map
            List<SaveModel> yearsList = new ArrayList();
@ -2343,21 +2345,27 @@ public class StatisticsESService {
            for (Map<String, Object> reMap : resultList) {
                reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
                int signNum = 0;
                int renewNum = 0;
                //获取去年签约的人数 默认是上个年度的最后一天
                if((resultMap!=null && resultMap.size()>0)&&(renewMap!=null && renewMap.size()>0)){
                if(resultMap!=null && resultMap.size()>0){
                    SaveModel one = resultMap.get(reMap.get("code").toString());
                    int signNum = 0;
                    int renewNum = renewMap.get(reMap.get("code").toString());
                    if (one != null) {
                        signNum = one.getResult2().intValue();
                    }
                    reMap.put("rate", getRange(renewNum, signNum, 2));//续签率是 续签量/去年的签约数
                    reMap.put("signNum", signNum);
                    reMap.put("renewNum", renewNum);
                }else{
                }
                if (renewMap!=null && renewMap.size()>0){
                     renewNum = renewMap.get(reMap.get("code").toString());
                }else{
                }
                reMap.put("renewNum", renewNum);
                reMap.put("signNum", signNum);
                reMap.put("rate", getRange(renewNum, signNum, 2));//续签率是 续签量/去年的签约数
            }
            if ((level == 4 && "1".equals(lowLevel)) || (level == 2) || (level == 3 && "1".equals(lowLevel))) {
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
                translateTeamLeaderName(resultList);
            }
            //对结果进行排序

+ 0 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/consult/DoctorConsultController.java

@ -1182,8 +1182,4 @@ public class DoctorConsultController extends WeixinBaseController {
            return error(-1,"添加失败");
        }
    }
    
}

+ 55 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/feedback/DoctorFeedbackTemplateController.java

@ -0,0 +1,55 @@
package com.yihu.wlyy.web.doctor.feedback;
import com.alibaba.fastjson.JSONArray;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.feedback.Feedback;
import com.yihu.wlyy.service.app.feedback.FeedbackService;
import com.yihu.wlyy.task.PushMsgTask;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Reece on 2017/5/6.
 */
@Controller
@RestController
@RequestMapping(value = "/doctor/feedback")
@Api(description = "医生端意见反馈")
public class DoctorFeedbackTemplateController extends BaseController {
    @Autowired
    private PushMsgTask pushMsgTask;
    @Autowired
    private CommonUtil CommonUtil;
    /**
     * 医生端发送系统消息
     * @param receiver 接受者
     * @param title 标题
     * @param content 内容
     * @return
     */
    @RequestMapping(value = "/sendMessage", method = RequestMethod.POST)
    @ApiOperation(value = "医生端发送系统消息")
    @ResponseBody
    @ObserverRequired
    public String saveFeedback(
            @RequestParam String receiver,
            @RequestParam String title,
            @RequestParam String content) {
        try {
            pushMsgTask.put(receiver, "8", title, content, "");
            return write(200, "发送成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "发送失败!");
        }
    }
}

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

@ -132,7 +132,7 @@ public class DoctorPrescriptionFollowupContentController extends BaseController
	}
	
	@RequestMapping(value = "/importfollowupcontent", method = RequestMethod.POST)
	@ApiOperation("续方患者的血压导入随访记录")
	@ApiOperation("续方患者的生活问卷导入随访记录")
	public String importfollowupcontent(
			@ApiParam(name = "prescriptioncode", value = "续方CODE", defaultValue = "")
			@RequestParam(value = "prescriptioncode", required = true) String prescriptioncode,

+ 12 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/reply/DoctorQuickReplyController.java

@ -1,6 +1,5 @@
package com.yihu.wlyy.web.doctor.reply;
import com.fasterxml.jackson.databind.deser.Deserializers;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.doctor.reply.DoctorQuickReply;
import com.yihu.wlyy.service.app.reply.DoctorQuickReplyService;
@ -29,13 +28,16 @@ public class DoctorQuickReplyController extends BaseController {
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    @ApiOperation(value = "添加快捷回复")
    public String addReply(@RequestParam @ApiParam(value = "快捷回复内容") String content) {
    public String addReply(
            @RequestParam(value = "content", required = true) @ApiParam(value = "快捷回复内容") String content,
            @ApiParam(name = "type", value = "快捷回复类型(1为续方咨询)", defaultValue = "0")
            @RequestParam(value = "type", required = false, defaultValue = "0") String type) {
        try {
            if (StringUtils.isEmpty(content)) {
                return error(-1, "快捷回复内容不能为空");
            }
            DoctorQuickReply reply = quickReplyService.addReply(getUID(), content);
            DoctorQuickReply reply = quickReplyService.addReply(getUID(), content,type);
            if (reply != null) {
                return write(200, "添加成功", "data", reply);
@ -51,7 +53,9 @@ public class DoctorQuickReplyController extends BaseController {
    @ApiOperation(value = "修改快捷回复")
    @ObserverRequired
    public String modifyReply(@RequestParam @ApiParam(value = "快捷回复ID") Long id,
                              @RequestParam @ApiParam(value = "快捷回复内容") String content) {
                              @RequestParam @ApiParam(value = "快捷回复内容") String content,
                              @ApiParam(name = "type", value = "快捷回复类型(1为续方咨询)", defaultValue = "0")
                                  @RequestParam(value = "type", required = false, defaultValue = "0") String type) {
        try {
            if (id == null || id < 1) {
                return error(-1, "快捷回复ID不能为空");
@ -60,7 +64,7 @@ public class DoctorQuickReplyController extends BaseController {
                return error(-1, "快捷回复内容不能为空");
            }
            DoctorQuickReply reply = quickReplyService.modifyReply(id, content);
            DoctorQuickReply reply = quickReplyService.modifyReply(id, content,type);
            if (reply != null) {
                return write(200, "添加成功", "data", reply);
@ -151,9 +155,10 @@ public class DoctorQuickReplyController extends BaseController {
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    @ApiOperation(value = "快捷回复列表")
    public String replyList() {
    public String replyList(@ApiParam(name = "type", value = "快捷回复类型(1为续方咨询)", defaultValue = "0")
                                @RequestParam(value = "type", required = false, defaultValue = "0") String type) {
        try {
            List<DoctorQuickReply> replies = quickReplyService.getDoctorReplyList(getUID());
            List<DoctorQuickReply> replies = quickReplyService.getDoctorReplyList(getUID(),type);
            return write(200, "查询成功", "data", replies);
        } catch (Exception e) {
            e.printStackTrace();

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java

@ -367,7 +367,7 @@ public class ConsultController extends WeixinBaseController {
                return error(-1, "还有咨询未结束,不允许再次提交咨询!");
            }
            Doctor doctor = doctorService.findDoctorByCode(consult.getDoctor());
//            Doctor doctor = doctorService.findDoctorByCode(consult.getDoctor());
            //创建咨询讨论组
            // JSONObject jo= talkGroupService.createConsultTalkGroup(consult.getDoctor(), doctor.getName(), doctor.getHospital(), doctor.getHospitalName(),
            //        consult.getPatient(), consult.getName(), consult.getConsult());

+ 61 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/feedback/PatientFeedbackTemplateController.java

@ -0,0 +1,61 @@
package com.yihu.wlyy.web.patient.feedback;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.service.app.feedback.FeedbackService;
import com.yihu.wlyy.util.CommonUtil;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.wechat.util.WeiXinTempMsgSendUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Reece on 2017/5/6.
 */
@Controller
@RestController
@RequestMapping(value = "/patient/feedback")
@Api(description = "居民端意见反馈")
public class PatientFeedbackTemplateController extends BaseController {
    @Autowired
    private WeiXinTempMsgSendUtils tempMsgSendUtils;
    @Value("${wechat.message.template_consult_notice}")
    private String templateId;
    /**
     * 居民端发送模板消息
     * @param toUser  接受者openID
     * @param url      跳转路径
     * @param first
     * @param remark
     * @param keywords
     * @return
     */
    @RequestMapping(value = "/sendTemplate", method = RequestMethod.POST)
    @ApiOperation(value = "居民端端发送模板消息")
    @ResponseBody
    @ObserverRequired
    public String saveFeedback(
            @RequestParam(required = true) String toUser,
            @RequestParam(required = false) String url,
            @RequestParam(required = true) String first,
            @RequestParam(required = true) String remark,
            @RequestParam(required = true) String ... keywords) {
        try {
            JSONObject data = tempMsgSendUtils.packageTemplate(first,remark,keywords);
            tempMsgSendUtils.sendTemplateMessage(templateId,toUser,url,data);
            return write(200, "发送成功!");
        } catch (Exception e) {
            error(e);
            return invalidUserException(e, -1, "发送失败!");
        }
    }
}

+ 0 - 7
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/prescription/PatientPrescriptionFollowupContentController.java

@ -28,7 +28,6 @@ public class PatientPrescriptionFollowupContentController extends BaseController
	@Autowired
	private PrescriptionFollowupContentService prescriptionFollowupContentService;
	
	
	@RequestMapping(value = "/getinfo", method = RequestMethod.GET)
	@ApiOperation("根据续方CODE、类型CODE,获取随访调查分类数据")
	public String getinfoByPrescriptionCodeAndFollowupProject(
@ -37,19 +36,14 @@ public class PatientPrescriptionFollowupContentController extends BaseController
			@ApiParam(name = "followupProject", value = "续方CODE", defaultValue = "问卷类型(症状、体征和问卷)")
			@RequestParam(value = "followupProject", required = true) String followupProject){
		try {
			
			List<PrescriptionFollowupContent> result = prescriptionFollowupContentService.getByPrescriptionCodeAndFollowupProject(prescriptioncode,followupProject);
			
			Map<String, String> datamap = new HashMap<>();
			
			if(!result.isEmpty()){
				for (PrescriptionFollowupContent prescriptionFollowupContent: result) {
					datamap.put(prescriptionFollowupContent.getFollowupKey(),prescriptionFollowupContent.getFollowupValue());
				}
			}
			
			return write(200, "请求成功!","data",datamap);
			
		}catch (Exception e){
			//日志文件中记录异常信息
			error(e);
@ -75,6 +69,5 @@ public class PatientPrescriptionFollowupContentController extends BaseController
			//返回接口异常信息处理结果
			return error(-1, "请求失败!"+e.getMessage());
		}
		
	}
}

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

@ -552,6 +552,7 @@ public class EsStatisticsController extends BaseController {
                        result.put("index_" + idx, statisticsESService.getAvgAllInfo(level, area, lowLevel));
                    } else if (idx.equals("13")) {
                        // sort=1&date=2017-07-13&level=4&index=13&area=350200&lowCode=
                        idx="1";
                        result.put("index_" + idx, statisticsESService.getLowLevelTotalTeamLeader(date, area, level, idx, sort, lowLevel, year));
                    } else {
                        result.put("index_" + idx, statisticsESService.getLowLevelTotal(date, area, level, idx, sort, lowLevel, year));
@ -1466,7 +1467,7 @@ public class EsStatisticsController extends BaseController {
     * @param level 等级  4 市  3区  2社区 1团队
     * @param area  市 默认是厦门市 350200  区 就是区的code  社区就是社区的code 团队就是团队的code.
     * @param year  年份 非比传
     * @param lowCode 服务类型维度code(老年人3,高血压4,糖尿病5)
     * @param lowCode 服务类型维度code(老年人3,高血压1,糖尿病2)
     * @return
     */
    @RequestMapping(value = "/getRenewPercentAndChangePercent", method = RequestMethod.GET)
@ -1555,7 +1556,7 @@ public class EsStatisticsController extends BaseController {
     * @param sort     0:升序 1:降序
     * @param lowLevel 只有可能是 1,2,3,不传默认是level-1;
     * @param year     不管根据当前时间找年度
     * @param lowCode  如果是服务类型维度code(老年人3,高血压4,糖尿病5)
     * @param lowCode  如果是服务类型维度code(老年人3,高血压1,糖尿病2)
     * @return
     */
    @RequestMapping("/lowlevel_all_sign_renew")

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

@ -409,7 +409,7 @@ public class StatisticsController extends BaseController {
            if (StringUtils.isEmpty(lowCode)) {
                long sign = statisticsAllService.getIndexTotal(endDate, area, level, "13");
                long sign = statisticsAllService.getIndexTotal(endDate, area, level, "1");
                long weiJf = statisticsAllService.getWeiJiaoFei(endDate, area, level);
                JSONObject jo = statisticsService.getRenewPercent(level + "", area, Constant.getNowYear());
                JSONObject signRate = statisticsAllService.getSignRate(endDate, area, level,year);

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

@ -72,6 +72,9 @@ public class PatientModel {
    // 居委会字段名称
    @ApiModelProperty(value = "居委会字段名称", required = false, access = "response")
    private String sickVillageName;
    //	绑定电子社保卡主体
    @ApiModelProperty(value = "绑定电子社保卡主体", required = false, access = "response")
    private String principalCode;
    //	是否绑定电子社保卡
    @ApiModelProperty(value = "是否绑定电子社保卡", required = false, access = "response")
    private Integer sicardStatus;
@ -86,6 +89,14 @@ public class PatientModel {
    @ApiModelProperty(value = "年龄", required = false, access = "response")
    private Integer age;
    public String getPrincipalCode() {
        return principalCode;
    }
    public void setPrincipalCode(String principalCode) {
        this.principalCode = principalCode;
    }
    public String getCode() {
        return code;
    }

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

@ -22,7 +22,7 @@ server:
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://ehr.yihu.com/wlyy/
  target_url: /prescription/www.baidu.com
  target_url: home/html/unreadMessageStatistic.html
im:

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

@ -22,7 +22,7 @@ server:
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://10.95.22.10:8011/wlyy/
  target_url: /prescription/www.baidu.com
  target_url: home/html/unreadMessageStatistic.html
im:

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

@ -22,7 +22,7 @@ server:
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://ehr.yihu.com/wlyy/
  target_url: /prescription/www.baidu.com
  target_url: home/html/unreadMessageStatistic.html
im:

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

@ -21,7 +21,7 @@ server:
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://www.xmtyw.cn/assistant/
  target_url: /prescription/www.baidu.com
  target_url: home/html/unreadMessageStatistic.html
im:

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

@ -22,7 +22,7 @@ server:
#医生助手服务器地址及模板跳转链接(医生未读消息统计页)
doctorAssistant:
  api: http://ehr.yihu.com/wlyy/
  target_url: /prescription/www.baidu.com
  target_url: home/html/unreadMessageStatistic.html
im:
  im_list_get: http://172.19.103.88:3000/