浏览代码

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

yeshijie 7 年之前
父节点
当前提交
ae56f0a025
共有 22 个文件被更改,包括 1295 次插入63 次删除
  1. 253 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/device/DeviceDetail.java
  2. 37 0
      common/common-entity/src/main/java/com/yihu/wlyy/entity/device/PatientDevice.java
  3. 11 4
      patient-co-service/wlyy_device/src/main/java/com/yihu/hos/device/service/DeviceService.java
  4. 46 46
      patient-co/patient-co-wlyy-job/src/main/resources/system.properties
  5. 1 1
      patient-co/patient-co-wlyy/pom.xml
  6. 1 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/config/SwaggerConfig.java
  7. 25 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/deviece/WlyyDeviceDetailDao.java
  8. 4 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientDeviceDao.java
  9. 16 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java
  10. 140 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceService.java
  11. 52 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/WlyyDeviceDetailService.java
  12. 143 3
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/statisticsES/StatisticsESService.java
  13. 215 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/health/bank/CreditLogService.java
  14. 91 4
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java
  15. 22 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java
  16. 1 1
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/consult/ConsultController.java
  17. 12 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java
  18. 48 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/statistic/EsStatisticsController.java
  19. 168 0
      patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/health/bank/CreditsLogController.java
  20. 3 0
      patient-co/patient-co-wlyy/src/main/resources/application-dev.yml
  21. 3 0
      patient-co/patient-co-wlyy/src/main/resources/application-devtest.yml
  22. 3 0
      patient-co/patient-co-wlyy/src/main/resources/application-test.yml

+ 253 - 0
common/common-entity/src/main/java/com/yihu/wlyy/entity/device/DeviceDetail.java

@ -0,0 +1,253 @@
package com.yihu.wlyy.entity.device;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * Created by zd on 2018/01/10.
 */
@Entity
@Table(name = "wlyy_devices")
public class DeviceDetail extends IdEntity{
    private String deviceName;
    private String deviceModel;
    private String deviceCode;
    private String manufacturer;
    private String applyDate;;
    private String orgName;
    private String linkman;
    private String tel;
    private String serverIp;
    private String manufacturerCode;
    private String address;
    private String representative;
    private String applicantName;
    private String applicantIdentity;
    private String applicantTel;
    private String applicantMail;
    private Integer isGrant;
    private String grantAdminTeam;
    private String grantHospital;
    private String bindingCount;
    private Date grantTime;
    /** default constructor */
    public DeviceDetail() {
    }
    /** full constructor */
    public DeviceDetail(String deviceName, String deviceModel, String deviceCode, String manufacturer, String applyDate
            , String orgName, String linkman, String tel, String serverIp, String manufacturerCode, String address
            , String representative, String applicantName, String applicantIdentity, String applicantTel, String applicantMail) {
        this.deviceName = deviceName;
        this.deviceModel = deviceModel;
        this.deviceCode = deviceCode;
        this.manufacturer = manufacturer;
        this.applyDate = applyDate;
        this.orgName = orgName;
        this.linkman = linkman;
        this.tel = tel;
        this.serverIp = serverIp;
        this.manufacturerCode = manufacturerCode;
        this.address = address;
        this.representative = representative;
        this.applicantName = applicantName;
        this.applicantIdentity = applicantIdentity;
        this.applicantTel = applicantTel;
        this.applicantMail = applicantMail;
    }
    @Column(name = "device_name")
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    @Column(name = "device_model")
    public String getDeviceModel() {
        return deviceModel;
    }
    public void setDeviceModel(String deviceModel) {
        this.deviceModel = deviceModel;
    }
    @Column(name = "device_code")
    public String getDeviceCode() {
        return deviceCode;
    }
    public void setDeviceCode(String deviceCode) {
        this.deviceCode = deviceCode;
    }
    @Column(name = "manufacturer")
    public String getManufacturer() {
        return manufacturer;
    }
    public void setManufacturer(String manufacturer) {
        this.manufacturer = manufacturer;
    }
    @Column(name = "apply_date")
    public String getApplyDate() {
        return applyDate;
    }
    public void setApplyDate(String applyDate) {
        this.applyDate = applyDate;
    }
    @Column(name = "org_name")
    public String getOrgName() {
        return orgName;
    }
    public void setOrgName(String orgName) {
        this.orgName = orgName;
    }
    @Column(name = "linkman")
    public String getLinkman() {
        return linkman;
    }
    public void setLinkman(String linkman) {
        this.linkman = linkman;
    }
    @Column(name = "tel")
    public String getTel() {
        return tel;
    }
    public void setTel(String tel) {
        this.tel = tel;
    }
    @Column(name = "server_ip")
    public String getServerIp() {
        return serverIp;
    }
    public void setServerIp(String serverIp) {
        this.serverIp = serverIp;
    }
    @Column(name = "manufacturerCode")
    public String getManufacturerCode() {
        return manufacturerCode;
    }
    public void setManufacturerCode(String manufacturerCode) {
        this.manufacturerCode = manufacturerCode;
    }
    @Column(name = "address")
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    @Column(name = "representative")
    public String getRepresentative() {
        return representative;
    }
    public void setRepresentative(String representative) {
        this.representative = representative;
    }
    @Column(name = "applicant_name")
    public String getApplicantName() {
        return applicantName;
    }
    public void setApplicantName(String applicantName) {
        this.applicantName = applicantName;
    }
    @Column(name = "applicant_identity")
    public String getApplicantIdentity() {
        return applicantIdentity;
    }
    public void setApplicantIdentity(String applicantIdentity) {
        this.applicantIdentity = applicantIdentity;
    }
    @Column(name = "applicant_tel")
    public String getApplicantTel() {
        return applicantTel;
    }
    public void setApplicantTel(String applicantTel) {
        this.applicantTel = applicantTel;
    }
    @Column(name = "applicant_mail")
    public String getApplicantMail() {
        return applicantMail;
    }
    public void setApplicantMail(String applicantMail) {
        this.applicantMail = applicantMail;
    }
    @Column(name = "is_grant")
    public Integer getIsGrant() {
        return isGrant;
    }
    public void setIsGrant(Integer isGrant) {
        this.isGrant = isGrant;
    }
    @Column(name = "grant_admin_team")
    public String getGrantAdminTeam() {
        return grantAdminTeam;
    }
    public void setGrantAdminTeam(String grantAdminTeam) {
        this.grantAdminTeam = grantAdminTeam;
    }
    @Column(name = "grant_hospital")
    public String getGrantHospital() {
        return grantHospital;
    }
    public void setGrantHospital(String grantHospital) {
        this.grantHospital = grantHospital;
    }
    @Column(name = "binding_count")
    public String getBindingCount() {
        return bindingCount;
    }
    public void setBindingCount(String bindingCount) {
        this.bindingCount = bindingCount;
    }
    @Column(name = "grant_time")
    public Date getGrantTime() {
        return grantTime;
    }
    public void setGrantTime(Date grantTime) {
        this.grantTime = grantTime;
    }
}

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

@ -34,6 +34,14 @@ public class PatientDevice extends IdEntity {
    private String agent;//代绑人代码(家人)
    private String agent;//代绑人代码(家人)
    // 操作时间
    // 操作时间
    private Date czrq;
    private Date czrq;
    //解绑人
    private String delUser;
    //1-解绑,0-绑定
    private Integer del;
    //设备活动类型
    private String deviceActivityType;
    //========================非表字段======================
    //========================非表字段======================
    //患者居住地址
    //患者居住地址
    private String address;
    private String address;
@ -65,6 +73,8 @@ public class PatientDevice extends IdEntity {
    //	this.del = del;
    //	this.del = del;
    //}
    //}
    @Column(name = "device_id")
    @Column(name = "device_id")
    public Long getDeviceId() {
    public Long getDeviceId() {
        return deviceId;
        return deviceId;
@ -165,6 +175,33 @@ public class PatientDevice extends IdEntity {
        this.agent = agent;
        this.agent = agent;
    }
    }
    @Column(name = "del_user")
    public String getDelUser() {
        return delUser;
    }
    public void setDelUser(String delUser) {
        this.delUser = delUser;
    }
    @Column(name = "del")
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    @Column(name = "device_activity_type")
    public String getDeviceActivityType() {
        return deviceActivityType;
    }
    public void setDeviceActivityType(String deviceActivityType) {
        this.deviceActivityType = deviceActivityType;
    }
    @Transient
    @Transient
    public String getAddress() {
    public String getAddress() {
        return address;
        return address;

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

@ -460,10 +460,17 @@ public class DeviceService extends BaseService{
            if (result == null) {
            if (result == null) {
                throw new Exception("This device is not relate patient!");
                throw new Exception("This device is not relate patient!");
            } else {
            } else {
	            //患者信息
	            String patientCode = result.getUser();
	            Patient patient = patientDao.findByCode(patientCode);
	
                //患者信息
                String patientCode = result.getUser();
                Patient patient = patientDao.findByCode(patientCode);
                //增加积分
                String url = wlyyService + "/healthBank/insertCredits";
                org.json.JSONObject params = new org.json.JSONObject();
                String creditDetail = "{\"tradeType\":\"HEALTH_TASK\",\"flag\":\"MEASURE\",\"tradeDirection\":1,\"status\":1,\"patientId\":\""+result.getUser()+"\",\"hospital\":\""+patient.getTown()+"\"}";
                params.put("creditsDetail", creditDetail);
                String response = HttpClientUtil.postBody(url, params);
	            //血糖、血压数据需校验,如果超标,需要发送消息给医生
	            //血糖、血压数据需校验,如果超标,需要发送消息给医生
	            if (1 == deviceType || 2 == deviceType) {
	            if (1 == deviceType || 2 == deviceType) {
		            verifyHealthIndex(result);
		            verifyHealthIndex(result);

+ 46 - 46
patient-co/patient-co-wlyy-job/src/main/resources/system.properties

@ -1,39 +1,39 @@
#-------------------------\u5171\u540C\u914D\u7F6E-----------------------------#
# \u9884\u7EA6\u914D\u7F6E\u53C2\u6570
#-------------------------共同配置-----------------------------#
# 预约配置参数
guahao_url = http://www.xmsmjk.com/UrpNetService/ReservationNet.asmx
guahao_url = http://www.xmsmjk.com/UrpNetService/ReservationNet.asmx
guahao_namespace = http://www.zysoft.com.cn/
guahao_namespace = http://www.zysoft.com.cn/
# \u57FA\u536B\u5BF9\u63A5\u670D\u52A1\u5730\u5740
# 基卫对接服务地址
jw_url = http://59.61.92.90:8072/wlyy_service
jw_url = http://59.61.92.90:8072/wlyy_service
# EHR\u6863\u6848\u670D\u52A1\u5730\u5740
# EHR档案服务地址
ehr_used = false
ehr_used = false
ehr_services = http://localhost:9009/api/v1.0/
ehr_services = http://localhost:9009/api/v1.0/
ehr_services_base = http://localhost:10220/api/v1.0/
ehr_services_base = http://localhost:10220/api/v1.0/
# \u5FAE\u4FE1\u56FE\u6587\u6D88\u606FURL
# 微信图文消息URL
doctor_qrcode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fssgg%2fhtml%2fdoctor-homepage-new.html&response_type=code&scope=snsapi_base&state={doctorCode}#wechat_redirect
doctor_qrcode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fssgg%2fhtml%2fdoctor-homepage-new.html&response_type=code&scope=snsapi_base&state={doctorCode}#wechat_redirect
doctor_hos_qrcode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fqygl%2fhtml%2fsearch-doctor.html&response_type=code&scope=snsapi_base&state={hospital}#wechat_redirect
doctor_hos_qrcode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fqygl%2fhtml%2fsearch-doctor.html&response_type=code&scope=snsapi_base&state={hospital}#wechat_redirect
doctor_subscribe_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fqygl%2fhtml%2fsigning-welcome.html&response_type=code&scope=snsapi_base&state=code#wechat_redirect
doctor_subscribe_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fqygl%2fhtml%2fsigning-welcome.html&response_type=code&scope=snsapi_base&state=code#wechat_redirect
doctor_town_qrcode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fqygl%2fhtml%2fsearch-community.html&response_type=code&scope=snsapi_base&state={town}#wechat_redirect
doctor_town_qrcode_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fqygl%2fhtml%2fsearch-community.html&response_type=code&scope=snsapi_base&state={town}#wechat_redirect
doctor_qrcode_pic_url={server}/images/familycontract.png
doctor_qrcode_pic_url={server}/images/familycontract.png
doctor_invitel_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fssgg%2fhtml%2fdoctor-homepage-new.html&response_type=code&scope=snsapi_base&state={doctorCode}__{invilogcode}__{currentPatient}__{currentZH}__{currentName}#wechat_redirect
doctor_invitel_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fssgg%2fhtml%2fdoctor-homepage-new.html&response_type=code&scope=snsapi_base&state={doctorCode}__{invilogcode}__{currentPatient}__{currentZH}__{currentName}#wechat_redirect
#\u5C31\u8BCA\u8BB0\u5F55
#就诊记录
patient_visit_url = https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiuzhenjilu.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
patient_visit_url = https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiuzhenjilu.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
#\u68C0\u67E5\u68C0\u9A8C
#检查检验
patient_inspect_url =https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjianchajianyan.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
patient_inspect_url =https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjianchajianyan.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
#\u793E\u533A\u4F53\u68C0
#社区体检
patient_examination_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiankangtijian.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
patient_examination_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fjkda%2fhtml%2fjiankangtijian.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
#\u5904\u65B9\u8BB0\u5F55
#处方记录
patient_prescription_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fprescription%2fhtml%2fprescription_records.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
patient_prescription_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fprescription%2fhtml%2fprescription_records.html&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect
#\u5C31\u8BCA\u8BB0\u5F55
#就诊记录
patient_visit_pic ={server}/images/visit.png
patient_visit_pic ={server}/images/visit.png
#\u68C0\u67E5\u68C0\u9A8C
#检查检验
patient_inspect_pic ={server}/images/inspect.png
patient_inspect_pic ={server}/images/inspect.png
#\u793E\u533A\u4F53\u68C0
#社区体检
patient_examination_pic={server}/images/examination.png
patient_examination_pic={server}/images/examination.png
#\u5904\u65B9\u8BB0\u5F55
#处方记录
patient_prescription_pic={server}/images/prescriptionRecords.png
patient_prescription_pic={server}/images/prescriptionRecords.png
patient_operatinginstrutions_pic_url={server}/images/operatinginstructions.png
patient_operatinginstrutions_pic_url={server}/images/operatinginstructions.png
@ -48,7 +48,7 @@ patient_device_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={ap
patient_family_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fintroduction%2fhtml%2ffamily.html&response_type=code&scope=snsapi_base&state=code#wechat_redirect
patient_family_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fintroduction%2fhtml%2ffamily.html&response_type=code&scope=snsapi_base&state=code#wechat_redirect
patient_sign_again_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fxuqian%2fhtml%2finformation.html&response_type=code&scope=snsapi_base&state=code#wechat_redirect
patient_sign_again_url=https://open.weixin.qq.com/connect/oauth2/authorize?appid={appId}&redirect_uri={server}%2fwx%2fhtml%2fxuqian%2fhtml%2finformation.html&response_type=code&scope=snsapi_base&state=code#wechat_redirect
# SMS\u77ED\u4FE1\u914D\u7F6E
# SMS短信配置
yihu_sms_url=https://smsapi.ums86.com:9600/sms/Api/Send.do
yihu_sms_url=https://smsapi.ums86.com:9600/sms/Api/Send.do
yihu_sms_code=229336
yihu_sms_code=229336
yihu_sms_name=jkzldxjr
yihu_sms_name=jkzldxjr
@ -57,83 +57,83 @@ yihu_guahao_url=http://ssotest.yihu.cn/OpenPlatform/cgiBin/1.0/
yihu_guahao_appid=sanshi
yihu_guahao_appid=sanshi
yihu_guahao_secret=sanshi
yihu_guahao_secret=sanshi
# \u4E0A\u4F20\u6587\u4EF6\u914D\u7F6E
# 上传文件配置
upload_temp_path=/var/local/temp
upload_temp_path=/var/local/temp
image_path=/var/local/upload/images
image_path=/var/local/upload/images
voice_path=/var/local/upload/voice
voice_path=/var/local/upload/voice
chat_file_path=/var/local/upload/chat
chat_file_path=/var/local/upload/chat
#\u7CFB\u7EDF\u7BA1\u7406\u5458token
#系统管理员token
admin_uid=admin
admin_uid=admin
admin_token=0a5c5258-8863-4b07-a3f9-88c768528ab4
admin_token=0a5c5258-8863-4b07-a3f9-88c768528ab4
# \u7B7E\u7EA6\u5230\u671FJOB\u89E6\u53D1\u65F6\u95F4,\u6BCF\u5E747\u67081\u65E5\u96F6\u70B9
# 签约到期JOB触发时间,每年7月1日零点
sign_end_job_trigger= 0 0 0 1 7 ?
sign_end_job_trigger= 0 0 0 1 7 ?
# \u7EED\u7B7E\u63D0\u9192JOB\u89E6\u53D1\u65F6\u95F4 (\u6BCF7\u5929\u4E00\u6B21)
# 续签提醒JOB触发时间 (每7天一次)
sign_again_job_trigger=59 59 23 7/7 * ?
sign_again_job_trigger=59 59 23 7/7 * ?
# \u7EED\u7B7E\u63D0\u9192JOB\u505C\u6B62\u65F6\u95F4
# 续签提醒JOB停止时间
sign_again_job_end=2017-10-1 00:00:00
sign_again_job_end=2017-10-1 00:00:00
# \u4EA7\u68C0\u63D0\u9192JOB\u89E6\u53D1\u65F6\u95F4 (\u6BCF\u59296\u70B9\u4E00\u6B21)
# 产检提醒JOB触发时间 (每天6点一次)
prenatal_inspector_job_trigger=0 0 6 * * ?
prenatal_inspector_job_trigger=0 0 6 * * ?
evaluate_score_job = 0 0 */2 * * ?
evaluate_score_job = 0 0 */2 * * ?
#\u7EED\u65B9\u652F\u4ED8\u5230\u671F,\u6BCF\u59290\u70B9\u89E6\u53D1
#续方支付到期,每天0点触发
prescription_pay_overdue_job = 0 0 0 * * ?
prescription_pay_overdue_job = 0 0 0 * * ?
#\u904D\u5386\u652F\u4ED8\u6210\u529F\uFF0C\u5FEB\u9012\u4E0B\u5355\u5931\u8D25\u7684\u8BB0\u5F55\uFF0C\u91CD\u65B0\u4E0B\u5355\uFF0C10\u5206\u949F\u8DD1\u4E00\u6B21
#遍历支付成功,快递下单失败的记录,重新下单,10分钟跑一次
sfexpress_reorder_job=0 0/10 * * * ?
sfexpress_reorder_job=0 0/10 * * * ?
#\u540C\u6B65\u667A\u4E1A\u5B57\u5178
#同步智业字典
zy_dict_job=0 0 1 * * ?
zy_dict_job=0 0 1 * * ?
#\u4EA7\u68C0\u63D0\u9192
#产检提醒
prenatal_inspector_job=0 0 8 * * ?
prenatal_inspector_job=0 0 8 * * ?
#\u904D\u5386\u652F\u4ED8\u6210\u529F\uFF0C\u9662\u5185\u7ED3\u7B97\u5931\u8D25\u7684\u7684\u8BB0\u5F55\uFF0C\u91CD\u65B0\u7ED3\u7B97\uFF0C3\u5206\u949F\u8DD1\u4E00\u6B21
#遍历支付成功,院内结算失败的的记录,重新结算,3分钟跑一次
zy_execute_sick_settle_job=0 0/3 * * * ?
zy_execute_sick_settle_job=0 0/3 * * * ?
#\u5904\u7406\u5F53\u5929\u652F\u4ED8\uFF0C\u9875\u9762\u56DE\u8C03\u53CA\u5F02\u6B65\u56DE\u8C03\u5931\u8D25\u7684\u652F\u4ED8\uFF0C\u6BCF3\u5206\u949F\u4E00\u6B21\u53BB\u4E3B\u52A8\u67E5\u8BE2\u5E76\u4FDD\u5B58
#处理当天支付,页面回调及异步回调失败的支付,每3分钟一次去主动查询并保存
prescription_pay_query_job=0 0/3 * * * ?
prescription_pay_query_job=0 0/3 * * * ?
#\u5C45\u6C1124\u5C0F\u65F6\u672A\u56DE\u590D\u7684\u54A8\u8BE2\u81EA\u52A8\u5173\u95ED \u6BCF\u5C0F\u65F659\u5206\u5F00\u59CB\u6267\u884C\u4E00\u6B21
#居民24小时未回复的咨询自动关闭 每小时59分开始执行一次
finish_consult_job=0 59 * * * ?
finish_consult_job=0 59 * * * ?
#\u63D0\u9192\u6709\u76D1\u6D4B\u65B9\u6848\u7684\u5C45\u6C11\u4E0A\u4F20\u6570\u636E\uFF0C\u6BCF\u969430\u5206\u949F\u6267\u884C\u4E00\u6B21
doctor_feldsher_template_job=0 0/30 * * * ?
#提醒有监测方案的居民上传数据,每隔30分钟执行一次
doctor_feldsher_template_job=0 */30 * * * ?
# \u75C5\u60A3\u8005\u5B9A\u6807\u60C5\u51B5\u540C\u6B65JOB (\u6BCF\u59292\u70B9\u4E00\u6B21)
# 病患者定标情况同步JOB (每天2点一次)
patient_disease_contion_syn_job=0 0 2 * * ?
patient_disease_contion_syn_job=0 0 2 * * ?
#\u67E5\u8BE2\u5BB6\u5EAD\u7B7E\u7EA6\u652F\u4ED8\u7ED3\u679C\uFF0C\u8865\u66F4\u65B0\u533B\u4FDD\u7B7E\u7EA6\u53F7,3\u5206\u949F\u8DD1\u4E00\u6B21
#查询家庭签约支付结果,补更新医保签约号,3分钟跑一次
sign_family_pay_result_migisterno_job=0 0/3 * * * ?
sign_family_pay_result_migisterno_job=0 0/3 * * * ?
# \u5BB6\u5EAD\u7B7E\u7EA6\u652F\u4ED8\u56DE\u8C03\u5931\u8D25\uFF0C\u6BCF3\u5206\u949F\u4E00\u6B21\u53BB\u4E3B\u52A8\u67E5\u8BE2\u5E76\u4FDD\u5B58
# 家庭签约支付回调失败,每3分钟一次去主动查询并保存
onepay_query_job=0 0/3 * * * ?
onepay_query_job=0 0/3 * * * ?
# \u8001\u5E74\u4EBA\u4F53\u68C0\u8BB0\u5F55\u540C\u6B65\uFF0C\u6BCF\u5929\u51CC\u66681\u70B9\u6267\u884C\u4E00\u6B21
# 老年人体检记录同步,每天凌晨1点执行一次
old_people_tijian_syb_job=0 0 1 * * ?
old_people_tijian_syb_job=0 0 1 * * ?
# \u540C\u6B65\u5C45\u6C11\u968F\u8BBF\u8BB0\u5F55\uFF0C\u6BCF\u5929\u51CC\u66683\u70B9\u6267\u884C\u4E00\u6B21
# 同步居民随访记录,每天凌晨3点执行一次
patient_followup_syb_job=0 0 3 * * ?
patient_followup_syb_job=0 0 3 * * ?
# \u5C45\u6C11\u968F\u8BBF\u8BB0\u5F55\u4E0A\u4F20\uFF08\u4E0A\u4F20\u5230\u57FA\u536B\uFF09\uFF0C10\u5206\u949F\u6267\u884C\u4E00\u6B21
# 居民随访记录上传(上传到基卫),10分钟执行一次
patient_followup_upload_job=0 0/10 * * * ?
patient_followup_upload_job=0 0/10 * * * ?
# \u8001\u5E74\u4EBA\u4F53\u68C0\u7CFB\u7EDF\u53D1\u9001\u63D0\u9192\u8BB0\u5F55\uFF0C\u6BCF\u59298\u70B9\u6267\u884C\u4E00\u6B21
# 老年人体检系统发送提醒记录,每天8点执行一次
patient_physical_examination_job=0 0 8 * * ?
patient_physical_examination_job=0 0 8 * * ?
# \u7535\u5B50\u793E\u4FDD\u5361\u7ED1\u5B9A\u72B6\u6001\u67E5\u8BE2\uFF0C\u6BCF\u96946\u5C0F\u65F6\u6267\u884C\u4E00\u6B21
# 电子社保卡绑定状态查询,每隔6小时执行一次
sicard_query_job=0 0 6,12,18,23 * * ?
sicard_query_job=0 0 6,12,18,23 * * ?
#\u533B\u751F\u7AEF\u4EA7\u68C0\u7CFB\u7EDF\u63D0\u9192\uFF08\u6BCF\u4E2A\u5DE5\u4F5C\u65E510\u70B9\u6267\u884C\u4E00\u6B21\uFF09
#医生端产检系统提醒(每个工作日10点执行一次)
doctor_prenatal_inspector_job=0 0 10 ? * MON-FRI
doctor_prenatal_inspector_job=0 0 10 ? * MON-FRI
# \u7EED\u65B9\u8BA2\u5355\u81EA\u52A8\u786E\u8BA4\u6536\u8D27\u5E76\u63A8\u9001\u6D88\u606F
patient_confirm_receipt_job=0 0 8,12,18,21 * * ?
#续方订单自动确认job
patient_confirm_receipt_job=00 0 8,12,18,21 * * ?
#\u7EDF\u4E00\u652F\u4ED8\u5E73\u53F0\u652F\u4ED8\u6210\u529F\u540E\u9875\u9762\u8DF3\u8F6C\u5730\u5740
#统一支付平台支付成功后页面跳转地址
return_url={server}/wx/html/qygl/html/pay_result.html
return_url={server}/wx/html/qygl/html/pay_result.html
#\u7EDF\u4E00\u652F\u4ED8\u5E73\u53F0\u652F\u4ED8\u63A5\u53E3\u5730\u5740
#统一支付平台支付接口地址
bindCardType=onepay.sicard.bind.info
bindCardType=onepay.sicard.bind.info
chargeType=onepay.trade.medical.charge
chargeType=onepay.trade.medical.charge
chargeQueryType=onepay.trade.medical.charge.query
chargeQueryType=onepay.trade.medical.charge.query
@ -141,9 +141,9 @@ createSicardType=onepay.sicard.createurl
receiveNotify=wlyy.onepay.receiveNotify
receiveNotify=wlyy.onepay.receiveNotify
returnUrl=wlyy.onepay.returnUrl
returnUrl=wlyy.onepay.returnUrl
#\u957F\u5904\u65B9
#redist\u8BA2\u9605\u6D88\u606F\u4E3B\u9898
#\u5F00\u65B9\u6210\u529F/\u5F00\u65B9\u5931\u8D25\u6D88\u606F\u4E3B\u9898
#长处方
#redist订阅消息主题
#开方成功/开方失败消息主题
redisMessage=redisMessage
redisMessage=redisMessage
#\u662F\u5426\u9700\u8981\u836F\u5E08\u5BA1\u65B9
#是否需要药师审方
pharmacistExaminationType=false
pharmacistExaminationType=false

+ 1 - 1
patient-co/patient-co-wlyy/pom.xml

@ -562,7 +562,7 @@
                    <target>1.8</target>
                    <target>1.8</target>
                    <compilerArguments>
                    <compilerArguments>
                        <verbose/>
                        <verbose/>
                        <bootclasspath>${java.home}/lib/rt.jar;${java.home}/lib/jce.jar</bootclasspath>
                        <bootclasspath>${java.home}/lib/rt.jar:${java.home}/lib/jce.jar</bootclasspath>
                    </compilerArguments>
                    </compilerArguments>
                </configuration>
                </configuration>
                <version>3.1</version>
                <version>3.1</version>

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

@ -184,6 +184,7 @@ public class SwaggerConfig {
                        regex("/nofilter/.*"),
                        regex("/nofilter/.*"),
                        regex("/idc10/.*"),
                        regex("/idc10/.*"),
                        regex("/iot/.*"),
                        regex("/iot/.*"),
                        regex("/healthBank/.*"),
                        regex("/im_new/.*"),
                        regex("/im_new/.*"),
                        regex("/dataHandling/.*"),
                        regex("/dataHandling/.*"),
                        regex("/version/.*"),
                        regex("/version/.*"),

+ 25 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/deviece/WlyyDeviceDetailDao.java

@ -0,0 +1,25 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.wlyy.repository.deviece;
import com.yihu.wlyy.entity.device.Device;
import com.yihu.wlyy.entity.device.DeviceDetail;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.Date;
import java.util.List;
public interface WlyyDeviceDetailDao extends PagingAndSortingRepository<DeviceDetail, Long> {
	@Query("select dd from DeviceDetail dd where dd.deviceCode=?1")
	DeviceDetail findByDeviceSn(String devicrSn);
	@Modifying
	@Query("update DeviceDetail dd set dd.isGrant=1,dd.grantAdminTeam=?1,dd.grantHospital=?2,dd.bindingCount=?3,dd.grantTime = ?4 where dd.deviceCode=?5")
	void updateAfterBinding(String adminTeam, String hospital, String isFirstBinding, Date grantTime,String deviceSn);
}

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

@ -35,6 +35,9 @@ public interface PatientDeviceDao extends PagingAndSortingRepository<PatientDevi
    PatientDevice findByDeviceSnAndUserType(String deviceSn, String userType);
    PatientDevice findByDeviceSnAndUserType(String deviceSn, String userType);
    @Query("select pd from PatientDevice pd where pd.deviceSn = ?1 and pd.del=0")
    List<PatientDevice> findByDeviceSn(String deviceSn);
    //更换患者绑定的血糖仪
    //更换患者绑定的血糖仪
    @Modifying
    @Modifying
    @Query("update PatientDevice t set t.deviceSn = ?3 , t.userType = ?4,t.sim=?5 where t.user = ?1 and t.deviceSn = ?2 ")
    @Query("update PatientDevice t set t.deviceSn = ?3 , t.userType = ?4,t.sim=?5 where t.user = ?1 and t.deviceSn = ?2 ")
@ -47,4 +50,5 @@ public interface PatientDeviceDao extends PagingAndSortingRepository<PatientDevi
    @Query("select a from PatientDevice a")
    @Query("select a from PatientDevice a")
    List<PatientDevice> findAll();
    List<PatientDevice> findAll();
}
}

+ 16 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/account/PatientInfoService.java

@ -1742,4 +1742,20 @@ public class PatientInfoService extends BaseService {
            return null;
            return null;
        }
        }
    }
    }
    public List<Map<String,Object>> getPatientSignByNameOrIdCard(String keyWord,String doctorId,int pageNo,int pageSize){
        Doctor doctor = doctorDao.findByCode(doctorId);
        String hospital = doctor.getHospital();
        int start = (pageNo-1)*pageSize;
        List<Map<String,Object>> patientList = new ArrayList<>();
        String sql = "SELECT p.code,p.name,CASE p.sex WHEN 1 THEN '男' WHEN 2 THEN '女' END sex,p.idcard,d.del,f.doctor_name" +
                " FROM wlyy_patient p  LEFT JOIN wlyy_sign_family f ON p.code = f.patient" +
                " LEFT JOIN wlyy_patient_device d ON p.code = d.user" +
                " WHERE f.status = 1 AND p.name LIKE '%"+keyWord+"%' OR p.idcard LIKE '%"+keyWord+"%' and f.hospital = '"+hospital+"'"+" limit ?,?";
        patientList = jdbcTemplate.queryForList(sql ,new Object[]{start,pageSize});
        for (Map<String,Object> map : patientList){
            map.put("age",IdCardUtil.getAgeForIdcard(String.valueOf(map.get("idcard"))));
        }
        return patientList;
    }
}
}

+ 140 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/PatientDeviceService.java

@ -1,10 +1,7 @@
package com.yihu.wlyy.service.app.device;
package com.yihu.wlyy.service.app.device;
import com.yihu.device.entity.DeviceDetail;
import com.yihu.device.entity.DeviceDetail;
import com.yihu.wlyy.entity.device.Device;
import com.yihu.wlyy.entity.device.PatientBloodSugger;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.device.PatientHealthTime;
import com.yihu.wlyy.entity.device.*;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.profile.Doctor;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
import com.yihu.wlyy.entity.doctor.team.sign.SignPatientLabelInfo;
@ -15,6 +12,7 @@ import com.yihu.wlyy.health.repository.DeviceDetailDao;
import com.yihu.wlyy.repository.deviece.DeviceDao;
import com.yihu.wlyy.repository.deviece.DeviceDao;
import com.yihu.wlyy.repository.deviece.PatientBloodSuggerDao;
import com.yihu.wlyy.repository.deviece.PatientBloodSuggerDao;
import com.yihu.wlyy.repository.deviece.PatientHealthTimeDao;
import com.yihu.wlyy.repository.deviece.PatientHealthTimeDao;
import com.yihu.wlyy.repository.deviece.WlyyDeviceDetailDao;
import com.yihu.wlyy.repository.dict.Icd10DictDao;
import com.yihu.wlyy.repository.dict.Icd10DictDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
import com.yihu.wlyy.repository.doctor.DoctorAdminTeamMemberDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
import com.yihu.wlyy.repository.doctor.DoctorDao;
@ -31,6 +29,7 @@ import com.yihu.wlyy.util.DateUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.HttpClientUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.IdCardUtil;
import com.yihu.wlyy.util.MyJdbcTemplate;
import com.yihu.wlyy.util.MyJdbcTemplate;
import org.apache.commons.collections.map.HashedMap;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONArray;
import org.json.JSONObject;
import org.json.JSONObject;
@ -65,6 +64,9 @@ public class PatientDeviceService extends BaseService {
    @Autowired
    @Autowired
    private PatientDeviceDao patientDeviceDao;
    private PatientDeviceDao patientDeviceDao;
    @Autowired
    private WlyyDeviceDetailDao wlyyWlyyDeviceDetailDao;
    @Autowired
    @Autowired
    private DeviceDao deviceDao;
    private DeviceDao deviceDao;
    @Autowired
    @Autowired
@ -193,6 +195,7 @@ public class PatientDeviceService extends BaseService {
            }
            }
        }
        }
        patientDevice.setCzrq(clock.getCurrentDate());
        patientDevice.setCzrq(clock.getCurrentDate());
        patientDevice.setDel(0);
        //当前用户的身份证
        //当前用户的身份证
        Patient patient = patientDao.findByCode(patientDevice.getUser());
        Patient patient = patientDao.findByCode(patientDevice.getUser());
        patientDevice.setUserIdcard(patient.getIdcard());
        patientDevice.setUserIdcard(patient.getIdcard());
@ -1153,4 +1156,137 @@ public class PatientDeviceService extends BaseService {
        result.put("list",list);
        result.put("list",list);
        return result;
        return result;
    }
    }
    public Map<String,Object> getDeviceByDeviceSn(String deviceSn)throws Exception {
        Map<String,Object> map  = new HashedMap();
        String sql = "SELECT d.id,d.device_name deviceName,d.device_model deviceMode,d.device_activity_type deviceActivityType,e.is_multi_user isMultiUser,e.category_code as deviceType,e.multi_user multiUser FROM wlyy_devices d LEFT JOIN dm_device e ON d.device_model = e.model WHERE d.device_code='"+deviceSn+"'";
        List<Map<String,Object>> mapSqlList = jdbcTemplate.queryForList(sql);
        if (mapSqlList!=null && mapSqlList.size()>0){
            map = mapSqlList.get(0);
        }
        List<PatientDevice> list = patientDeviceDao.findByDeviceSn(deviceSn);
        List<Map<String,Object>> mapList = new ArrayList<>();
        for (PatientDevice patientDevice : list) {
            Map<String,Object> infoMap = new HashedMap();
            Patient patient = patientDao.findByCode(patientDevice.getUser());
            infoMap.put("patientDeviceId",patientDevice.getId());
            infoMap.put("userCode",patient.getCode());
            infoMap.put("userName",patient.getName());
            infoMap.put("idCard",patient.getIdcard());
            infoMap.put("userType",patientDevice.getUserType());
            mapList.add(infoMap);
        }
        map.put("bindingInfo",mapList);
        return map;
    }
    public boolean isFirstNewBinding(String deviceSn,String userType){
        boolean flag = true;
        com.yihu.wlyy.entity.device.DeviceDetail deviceDetail = wlyyWlyyDeviceDetailDao.findByDeviceSn(deviceSn);
        if (deviceDetail!=null){
            JSONObject jsonObject =new JSONObject(deviceDetail.getBindingCount());
            if (jsonObject.getInt(userType)>0){
                flag=false;
            }
        }
        return flag;
    }
    /**
     * 验证sn码 先调总部接口 未注册才查询本地数据库,如果也没有才不能绑定
     * @param deviceSn
     * @return
     * @throws Exception
     */
    public Map<String,Object> checkBindingDeviceSn(String deviceSn) throws Exception{
        Boolean flag = false;
        String message = "";
        Integer resultCode = 200;
        Map<String, String> params = new HashMap<>();
        params.put("deviceSn", deviceSn);
        //调用服务
        String response = HttpClientUtil.httpPost(url + registerDevice, HttpClientUtil.getSecretParams(params, appid, secret));
        System.out.println("注册设备=" + response);
        JSONObject json = new JSONObject(response);
        String code = json.get("Code").toString();
        //10000注册成功 10001已注册 -10000参数不通过(没传参数) -10001设备不存在 -10002设备未出库
        if ("10000".equals(code) || "10001".equals(code)) {
            flag = true;
        }else {
            String sql ="select count(*) num from wlyy_devices where device_code = '"+deviceSn+"'";
            Map<String,Object> map  = jdbcTemplate.queryForMap(sql);
            if (Integer.valueOf(String.valueOf(map.get("num")))>0){
                flag = true ;
                /*if (patientDeviceDao.findByDeviceSn(deviceSn)==null){
                    flag = true ;
                    message="设备可以绑定";
                }else {
                    resultCode = -10000;
                    message="已经被绑定了!";
                }*/
            }else {
                resultCode = -10001;
                message="没有该设备!";
            }
        }
        Map<String,Object> map = new HashedMap();
        map.put("code",resultCode);
        map.put("message",message);
        map.put("flag",flag);
        return map;
    }
    public Map<String,Object> getPatientDeviceTaskInfo(String patientCode)throws Exception{
        Map<String,Object> resultMap = new HashedMap();
        String sql = "SELECT d.binding_count,pd.user_type FROM wlyy_patient_device pd LEFT JOIN wlyy_devices d ON pd.device_sn = d.device_code where pd.del=0 and pd.user='"+patientCode+"'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        int count = 0;
        //查询一共绑定了多少个设备
        for (Map<String,Object> map : list){
            if (map.get("binding_count")!=null){
                JSONObject jsonObject =  new JSONObject(String.valueOf(map.get("binding_count")));
                Set<String> keyset = jsonObject.keySet();
                for (String key : keyset){
                    if (key.equals(String.valueOf(map.get("user_type"))) && jsonObject.getInt(key)==1){
                        count++;
                    }
                }
            }
        }
        resultMap.put("deviceCount",count);
        //体征上传表查询是否有今天的数据
        int healthBp = 0;
        int healthBs = 0;
        int resultHealty= 0;
        boolean hasUploadHealth = false;
        String today = DateUtil.dateToStr(DateUtil.getDateShort(new Date()),"yyyy-MM-dd");
        String healthSql ="SELECT type as healtyType,device_sn deviceSn FROM device.wlyy_patient_health_index where czrq >'"+today+" 00:00:00' and czrq<='"+today+" 23:59:59' and  status = 0 and  del = 1 and user = '"+patientCode+"'";
        List<Map<String,Object>>  maps =jdbcTemplate.queryForList(healthSql);
        for (Map<String,Object> map : maps){
            if (map.get("type")!=null && String.valueOf(map.get("Type")).equals("1")){
                //血糖
                healthBs=1;
            }
            if (map.get("type")!=null && String.valueOf(map.get("Type")).equals("2")){
                //血压
                healthBp=1;
            }
        }
        if (healthBp==1 && healthBs ==0){
            resultHealty =1;
        }
        if (healthBs ==1 && healthBp==0){
            resultHealty = 2;
        }
        if (healthBp ==1 && healthBs ==1){
            resultHealty = 3;
        }
        resultMap.put("resultHealty",resultHealty);
        return resultMap;
    }
}
}

+ 52 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/device/WlyyDeviceDetailService.java

@ -0,0 +1,52 @@
package com.yihu.wlyy.service.app.device;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.device.DeviceDetail;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.repository.deviece.WlyyDeviceDetailDao;
import com.yihu.wlyy.repository.patient.SignFamilyDao;
import com.yihu.wlyy.service.BaseService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.Date;
import java.util.List;
/**
 * 设备管理
 */
@Component
@Transactional(rollbackFor = Exception.class)
public class WlyyDeviceDetailService extends BaseService {
	@Autowired
	private WlyyDeviceDetailDao wlyyDeviceDetailDao;
	@Autowired
	private SignFamilyDao signFamilyDao;
	public void updateAfterBinding(String deviceSn, String idCard, String userType, Date grantTime)throws Exception{
		DeviceDetail deviceDetail = wlyyDeviceDetailDao.findByDeviceSn(deviceSn);
		List<SignFamily> signFamilyList = signFamilyDao.findSSandJTByIdcard(idCard);
		String adminTeam="";
		String hospital = "";
		String isFirstBind = "";
		if (signFamilyList!=null && signFamilyList.size()>0){
			adminTeam = signFamilyList.get(0).getTeamCode();
			hospital = signFamilyList.get(0).getHospital();
		}
		if (deviceDetail!=null){
			isFirstBind = deviceDetail.getBindingCount();
			if (StringUtils.isNotBlank(isFirstBind)){
				JSONObject jsonObject = JSON.parseObject(isFirstBind);
				int bindCount = Integer.valueOf(String.valueOf(jsonObject.get(userType)));
				jsonObject.replace(userType,userType+1);
				isFirstBind = jsonObject.toJSONString();
			}
		}
		wlyyDeviceDetailDao.updateAfterBinding(adminTeam,hospital,isFirstBind,grantTime,deviceSn );
	}
}

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

@ -929,7 +929,9 @@ public class StatisticsESService {
            for (SaveModel saveModel : saveModels) {
            for (SaveModel saveModel : saveModels) {
                JSONObject json = new JSONObject();
                JSONObject json = new JSONObject();
                String range = null;
                String range = null;
                range = df.format(saveModel.getQuotaDate());
                if(saveModel.getQuotaDate()!=null){
                    range = df.format(saveModel.getQuotaDate());
                }
                long amount = saveModel.getResult2().longValue();
                long amount = saveModel.getResult2().longValue();
                json.put("range", range);
                json.put("range", range);
                json.put("amount", amount);
                json.put("amount", amount);
@ -1066,7 +1068,10 @@ public class StatisticsESService {
        if (saveModels != null) {
        if (saveModels != null) {
            // 计算结果
            // 计算结果
            for (SaveModel saveModel : saveModels) {
            for (SaveModel saveModel : saveModels) {
                String range = df.format(saveModel.getQuotaDate());
                String range = "";
                if (saveModel.getQuotaDate()!=null){
                    range = df.format(saveModel.getQuotaDate());
                }
                JSONObject json = countResult.get(range);
                JSONObject json = countResult.get(range);
                if (json != null) {
                if (json != null) {
@ -1184,7 +1189,10 @@ public class StatisticsESService {
        if (saveModels != null) {
        if (saveModels != null) {
            // 计算结果
            // 计算结果
            for (SaveModel saveModel : saveModels) {
            for (SaveModel saveModel : saveModels) {
                String range = df.format(saveModel.getQuotaDate());
                String range = "";
                if (saveModel.getQuotaDate()!=null){
                    range = df.format(saveModel.getQuotaDate());
                }
                JSONObject json = countResult.get(range);
                JSONObject json = countResult.get(range);
                if (json != null) {
                if (json != null) {
@ -5138,4 +5146,136 @@ public class StatisticsESService {
        return saveModel.getResult2().longValue();
        return saveModel.getResult2().longValue();
    }
    }
    public Map<String,Object> getLevelDeviceAndBinding(String area, int level, int sort, String lowLevel, String year) throws Exception {
        String index_85 = "85";
        String index_86= "86";
        String lastDate = year + "-06-30";
        String timeKey = elasticsearchUtil.getQuotaTime();
        String low_level = String.valueOf(StringUtils.isEmpty(lowLevel) ? (level + 1) : lowLevel);
        List<Map<String, Object>> resultList = new ArrayList<>();
        Map<String,Object> resultMap = new HashedMap();
        //发放量
        List<SaveModel> allAmountList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index_85, SaveModel.timeLevel_DDL, "", low_level);
        //绑定量
        List<SaveModel> bindingAmountList = elasticsearchUtil.findDateQuotaLevel0(timeKey, timeKey, area, level, index_86, SaveModel.timeLevel_DDL, "", low_level);
        Integer totalAllNum = allAmountList.get(0).getResult2().intValue();
        Integer totalBindingNum = bindingAmountList.get(0).getResult2().intValue();
        resultMap.put("totalAll",totalAllNum);
        resultMap.put("totalBinding",totalBindingNum);
        resultMap.put("totalRange",getRange(totalBindingNum, totalAllNum, 2));
        Map<String, Integer> allMap = new HashMap<>(); //发放量的的列表转map
        if (allAmountList != null && allAmountList.size() > 0) {
            for (SaveModel saveModel : allAmountList) {
                if ("3".equals(low_level) && saveModel.getTown() != null) {
                    allMap.put(saveModel.getTown(), saveModel.getResult2().intValue());
                } else if ("4".equals(low_level) && saveModel.getHospital() != null) {
                    allMap.put(saveModel.getHospital(), saveModel.getResult2().intValue());
                } else if ("5".equals(low_level) && saveModel.getTeam() != null) {
                    allMap.put(saveModel.getTeam(), saveModel.getResult2().intValue());
                } else {
                    continue;
                }
            }
        }
        //自建结果集
        resultList = getLowLevelMapKey(level, low_level, area);
        if (resultList != null && resultList.size() > 0) {
            Map<String, SaveModel> bingdingMap = new HashMap<>();
            DecimalFormat df = new DecimalFormat("0.0000");
            bindingAmountList.stream().forEach(one -> {
                if ("5".equals(low_level)) {
                    bingdingMap.put(one.getTeam(), one);
                } else if ("4".equals(low_level)) {
                    bingdingMap.put(one.getHospital(), one);
                } else if ("3".equals(low_level)) {
                    bingdingMap.put(one.getTown(), one);
                }
            });
            for (Map<String, Object> reMap : resultList) {
                reMap.put("amount", reMap.get("amount") != null ? Long.valueOf(reMap.get("amount").toString()) : 0L);
                int bindingAmount = 0;
                Integer allAmount = 0;
                //获取绑定数量
                if (bingdingMap != null && bingdingMap.size() > 0) {
                    SaveModel one = bingdingMap.get(reMap.get("code").toString());
                    if (one != null) {
                        bindingAmount = one.getResult2().intValue();
                    }
                }
                if (allMap != null && allMap.size() > 0) {
                    allAmount = allMap.get(reMap.get("code").toString());
                    if (allAmount == null) {
                        allAmount = 0;
                    }
                } else {
                }
                reMap.put("allNum", allAmount);
                reMap.put("bindingNum", bindingAmount);
                reMap.put("rate", getRange(bindingAmount, allAmount, 2));//续签率是 续签量/去年的签约数
            }
            if ((level == 2 && "5".equals(lowLevel)) || (level == 4) || (level == 3 && "5".equals(lowLevel))) {
                translateTeamLeaderName(resultList);
            }
            //对结果进行排序
            Collections.sort(resultList, new Comparator<Map<String, Object>>() {
                public int compare(Map<String, Object> o1, Map<String, Object> o2) {
                    int map1value = (int) o1.get("allNum");
                    int map2value = (int) o2.get("allNum");
                    if (map1value - map2value > 0) {
                        return sort == 1 ? -1 : 1;
                    } else if (map1value - map2value < 0) {
                        return sort == 1 ? 1 : -1;
                    } else {
                        return 0;
                    }
                }
            });
            resultMap.put("list",resultList);
            return resultMap;
        } else {
            return new HashedMap();
        }
    }
    /**
     * 查询签约
     *
     * @param type      0 按周,1 按月
     * @param startDate
     * @param endDate
     * @return
     */
    /*public JSONArray getDeviceLine(String doctor, String type, String startDate, String endDate) throws Exception {
        AdminTeam admin = adminTeamDao.findByLeaderCode(doctor);
        if (admin == null) {
            throw new RuntimeException("未找到团队信息");
        }
        Long id = admin.getId();
        List<SaveModel> allList = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.valueOf(SaveModel.teamLevel), "85", SaveModel.timeLevel_ZL, String.valueOf(Integer.valueOf(type) + 1));
        List<SaveModel> bindingList = elasticsearchUtil.findLineChartDateQuotaLevel0(startDate, endDate, id + "", Integer.valueOf(SaveModel.teamLevel), "86", SaveModel.timeLevel_ZL, String.valueOf(Integer.valueOf(type) + 1));
        List<Map<String, Object>> rs = new ArrayList<>();
        for (SaveModel saveModel : list) {
            Map<String, Object> map = new HashMap<>();
            //map.put("applyDate", dateFormat.format(saveModel.getQuotaDate()));
            if ("0".equals(type)) {
                map.put("applyDate", dateFormat.format(saveModel.getQuotaDate()));
            } else {
                map.put("weekOfMonth", DateUtil.getWeekOfMonth(saveModel.getQuotaDate()));
            }
            map.put("signCount", saveModel.getResult2().longValue());
            rs.add(map);
        }
        JSONArray rsJs = new JSONArray(rs);
        return rsJs;
    }*/
}
}

+ 215 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/third/health/bank/CreditLogService.java

@ -0,0 +1,215 @@
package com.yihu.wlyy.service.third.health.bank;/**
 * Created by nature of king on 2018/5/7.
 */
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.entity.patient.SignFamily;
import com.yihu.wlyy.service.app.device.PatientDeviceService;
import com.yihu.wlyy.util.HttpClientUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @author wangzhinan
 * @create 2018-05-07 9:24
 * @desc wlyy health bank service
 **/
@Service
@Transactional
public class CreditLogService {
    private Logger logger = LoggerFactory.getLogger(CreditLogService.class);
    @Value("${healthBank.url}")
    private String baseUrl;
    //    private String baseUrl = "http://192.168.131.24:8088/svr-iot/";
    @Autowired
    private HttpClientUtil httpClientUtil;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private StringRedisTemplate redisTemplate;
    @Autowired
    private PatientDeviceService patientDeviceService;
    /**
     * 调用第三方积分排名接口
     *
     * @param doctorId
     * @param page
     * @param size
     * @return
     */
    public JSONObject selectByRanking(String doctorId, Integer page, Integer size){
        String sql = "SELECT * FROM wlyy_sign_family WHERE status = 1 AND doctor = '" +doctorId + "'";
        List<SignFamily> signFamilyList = jdbcTemplate.query(sql,new BeanPropertyRowMapper(SignFamily.class));
        List<String>  patientIds = new ArrayList<>();
        if (signFamilyList != null && signFamilyList.size() != 0){
            for (SignFamily signFamily:signFamilyList){
                patientIds.add(signFamily.getPatient());
            }
        }
        JSONObject object = new JSONObject();
        object.put("filter",patientIds.toArray());
        object.put("page",page);
        object.put("size",size);
        String url = baseUrl + "selectByRanking";
        String response = null;
        JSONArray data =null;
        JSONObject object1 = null;
        try {
            response = httpClientUtil.iotPostBody(url,object.toString());
            object1 = JSONObject.parseObject(response);
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return object1;
    }
    /**
     * 调用添加积分接口
     *
     * @param object
     * @return
     */
    public JSONObject insert(JSONObject object){
        init();
        String response = null;
        String integrate = getIntegrate("health:blank:integrate:"+object.getString("flag"));
        object.put("integrate",integrate);
        String url =baseUrl + "createCreditsDetail";
        Map<String,String> params = new HashMap<>();
        params.put("creditsDetail",object.toJSONString());
        try {
            response = httpClientUtil.httpPost(url,params);
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return JSONObject.parseObject(response);
    }
    /**
     * 按条件查询积分
     *
     * @param object
     * @param page
     * @param size
     * @return
     */
    public JSONObject selectByCondition(JSONObject object,Integer page,Integer size){
        String response = null;
        String url =baseUrl + "findCreditsLogInfo";
        Map<String,String> params = new HashMap<>();
        params.put("creditsDetail",object.toJSONString());
        params.put("page",page.toString());
        params.put("size",size.toString());
        try {
            response = httpClientUtil.httpPost(url,params);
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return JSONObject.parseObject(response);
    }
    /**
     * 查询账户积分详情
     *
     * @param object
     * @return
     */
    public JSONObject selectAccount(JSONObject object){
        String response = null;
        String url =baseUrl + "selectAccount";
        Map<String,String> params = new HashMap<>();
        params.put("creditsDetail",object.toJSONString());
        try {
            response = httpClientUtil.httpPost(url,params);
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return JSONObject.parseObject(response);
    }
    /**
     * 查询任务完成情况
     *
     * @param object
     * @param page
     * @param size
     * @return
     */
    public JSONObject selectByTask(JSONObject object,Integer page,Integer size){
        String response = null;
        String url =baseUrl + "findTask";
        Map<String,String> params = new HashMap<>();
        params.put("task",object.toJSONString());
        params.put("page",page.toString());
        params.put("size",size.toString());
        String patientId = object.getString("patientId");
        try {
            response = httpClientUtil.httpPost(url,params);
            Map<String,Object> taskInfo = patientDeviceService.getPatientDeviceTaskInfo(patientId);
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return JSONObject.parseObject(response);
    }
    /**
     * 查询银行账户信息
     *
     * @param object 账户对象
     * @param page 页码
     * @param size 每页大小
     * @return
     */
    public JSONObject selectByAccount(JSONObject object,Integer page,Integer size){
        String response = null;
        String url =baseUrl + "findAccount";
        Map<String,String> params = new HashMap<>();
        params.put("account",object.toJSONString());
        params.put("page",page.toString());
        params.put("size",size.toString());
        try {
            response = httpClientUtil.httpPost(url,params);
        }catch (Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
        }
        return JSONObject.parseObject(response);
    }
    public void init(){
        redisTemplate.opsForValue().set("health:blank:integrate:BIND","20");
        redisTemplate.opsForValue().set("health:blank:integrate:MEASURE","20");
    }
    public String getIntegrate(String key){
        return redisTemplate.opsForValue().get(key);
    }
}

+ 91 - 4
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/device/DoctorDeviceController.java

@ -1,11 +1,16 @@
package com.yihu.wlyy.web.doctor.device;
package com.yihu.wlyy.web.doctor.device;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.aop.ObserverRequired;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.device.PatientDevice;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.doctor.team.admin.AdminTeam;
import com.yihu.wlyy.entity.patient.Patient;
import com.yihu.wlyy.service.app.device.WlyyDeviceDetailService;
import com.yihu.wlyy.service.app.device.PatientDeviceService;
import com.yihu.wlyy.service.app.device.PatientDeviceService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.app.team.AdminTeamService;
import com.yihu.wlyy.service.common.account.PatientService;
import com.yihu.wlyy.service.third.health.bank.CreditLogService;
import com.yihu.wlyy.web.BaseController;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -14,12 +19,11 @@ import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -36,11 +40,22 @@ public class DoctorDeviceController extends BaseController {
	@Autowired
	@Autowired
	private PatientDeviceService patientDeviceService;
	private PatientDeviceService patientDeviceService;
	@Autowired
	private WlyyDeviceDetailService wlyyDeviceDetailService;
	@Autowired
	@Autowired
	private AdminTeamService adminTeamService;
	private AdminTeamService adminTeamService;
	@Autowired
	private CreditLogService creditLogService;
	@Autowired
	private PatientService patientService;
	private ObjectMapper  objectMapper=new ObjectMapper();
	private ObjectMapper  objectMapper=new ObjectMapper();
	private JdbcTemplate jdbcTemplate;
	@ApiOperation("设备保存接口--医生端")
	@ApiOperation("设备保存接口--医生端")
	@RequestMapping(value = "SavePatientDevice",method = RequestMethod.POST)
	@RequestMapping(value = "SavePatientDevice",method = RequestMethod.POST)
	@ResponseBody
	@ResponseBody
@ -51,9 +66,44 @@ public class DoctorDeviceController extends BaseController {
			PatientDevice device = objectMapper.readValue(data,PatientDevice.class);
			PatientDevice device = objectMapper.readValue(data,PatientDevice.class);
			// 设置操作医生标识
			// 设置操作医生标识
			device.setDoctor(getUID());
			device.setDoctor(getUID());
			//绑定
			patientDeviceService.saveDevice(device);
			return success("设备保存成功!");
		}
		catch (Exception ex) {
			error(ex);
			return invalidUserException(ex, -1, ex.getMessage());
		}
	}
	@ApiOperation("设备保存接口并且添加积分--医生端")
	@RequestMapping(value = "SavePatientDeviceAndCredit",method = RequestMethod.POST)
	@ResponseBody
	@ObserverRequired
	public String SavePatientDeviceAndCredit(@ApiParam(name="data",value="设备数据json",defaultValue = "{\"user\":\"915cca0a-5b1d-11e6-8344-fa163e8aee56\",\"deviceId\": \"3\",\"deviceName\": \"血压计-优瑞恩\",\"deviceSn\": \"16C000337\",\"categoryCode\": \"1\",\"userType\": \"-1\"}")
							 @RequestParam(value="data",required = true) String data) {
		try {
			PatientDevice device = objectMapper.readValue(data,PatientDevice.class);
			// 设置操作医生标识
			device.setDoctor(getUID());
			//首绑加分判断
			boolean flag = patientDeviceService.isFirstNewBinding(device.getDeviceSn(),device.getUserType());
			//绑定
			patientDeviceService.saveDevice(device);
			patientDeviceService.saveDevice(device);
			//修改设备表中是否是首绑{"1":"1", "2":"1"}修改成{"1":"0", "2":"0"} 和其他绑定信息,
			wlyyDeviceDetailService.updateAfterBinding(device.getDeviceSn(),device.getUserIdcard(),device.getUserType(),new Date());
			//调用增加积分接口
			if (flag){
				Patient patient = patientService.findByCode(device.getUser());
				String creditDetail = "{\"tradeType\":\"HEALTH_TASK\",\"flag\":\"BIND\",\"tradeDirection\":1,\"status\":1,\"patientId\":\""+device.getUser()+"\",\"hospital\":\""+patient.getTown()+"\"}";
				JSONObject jsonObject = JSONObject.parseObject(creditDetail);
				JSONObject response = creditLogService.insert(jsonObject);
				System.out.println(response.toJSONString());
			}
			return success("设备保存成功!");
			return success("设备保存成功!");
		}
		}
		catch (Exception ex) {
		catch (Exception ex) {
@ -227,4 +277,41 @@ public class DoctorDeviceController extends BaseController {
			JSONArray objects = patientDeviceService.getDeviceByDeviceSn(deviceSn,type);
			JSONArray objects = patientDeviceService.getDeviceByDeviceSn(deviceSn,type);
			return write(200, "获取设备成功!", "data",objects);
			return write(200, "获取设备成功!", "data",objects);
	}
	}
	@ApiOperation("根据sn码获取设备的信息和绑定信息")
	@RequestMapping(value = "/getDeviceInfoByDeviceSn",method = RequestMethod.GET)
	@ResponseBody
	public String getDeviceInfoByDeviceSn(@ApiParam(name="deviceSn",value="设备SN码",defaultValue = "15L000002")
														  @RequestParam(value="deviceSn",required = true) String deviceSn){
		//JSONArray objects = patientDeviceService.getDeviceByDeviceSn(deviceSn);
		try{
			Map<String,Object> checkMap = patientDeviceService.checkBindingDeviceSn(deviceSn);
			boolean checkFlag = (Boolean)checkMap.get("flag");
			if (!checkFlag){
				return write(-1,String.valueOf(checkMap.get("message")));
			}
			return write(200, "获取设备成功!", "data",patientDeviceService.getDeviceByDeviceSn(deviceSn));
		}catch (Exception e){
			error(e);
			return write(-1,"程序出错!");
		}
	}
	@RequestMapping(value = "/checkIsBinding",method = RequestMethod.POST)
	@ResponseBody
	@ApiOperation(value = "根据sn码查询设备是否已经绑定和存在",notes = "绑定设备前的判断")
	public String findDeviceAndBindingBySn(@ApiParam(name = "deviceSn", value = "", defaultValue = "") @RequestParam(value = "deviceSn")String deviceSn){
		if (org.springframework.util.StringUtils.isEmpty(deviceSn)){
			return write(-1,"参数格式错误!");
		}
		try{
			Map<String,Object> map = patientDeviceService.checkBindingDeviceSn(deviceSn);
			return  write(200,String.valueOf(map.get("message")),"data",(Boolean)map.get("flag"));
			//return  write(200,"123","data","111111");
		}catch (Exception e){
			e.printStackTrace();
			return  write(-1,"操作失败!");
		}
	}
}
}

+ 22 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/doctor/patient/PatientInfoController.java

@ -23,6 +23,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestMethod;
@ -59,6 +60,8 @@ public class PatientInfoController extends BaseController {
    @Autowired
    @Autowired
    private SendMessageService sendMessageService;
    private SendMessageService sendMessageService;
    private JdbcTemplate jdbcTemplatel;
    private static Logger logger = LoggerFactory.getLogger(PatientInfoController.class);
    private static Logger logger = LoggerFactory.getLogger(PatientInfoController.class);
    /**
    /**
@ -514,5 +517,24 @@ public class PatientInfoController extends BaseController {
        }
        }
    }
    }
    @RequestMapping(value = "/getPatientSignByNameOrIdCard",method = RequestMethod.GET)
    @ResponseBody
    @ApiOperation("在绑定设备的时候查找患者(带签约信息)")
    public String getPatientSignByNameOrIdCard(@ApiParam(value = "关键搜索词", name = "keyWord") @RequestParam(value = "keyWord",required = true)String keyWord,
                                                @ApiParam(name="page",value="第几页",defaultValue = "1") @RequestParam(value="page",required = true) String page,
                                                @ApiParam(name="pageSize",value="",defaultValue = "10") @RequestParam(value="pageSize",required = true) String pageSize){
        if (StringUtils.isBlank(pageSize)) {
            pageSize = "10";
        }
        if (page.equals("0")){
            page = "1";
        }
        try {
            return  write(200,"查找成功!","data",patientInfoService.getPatientSignByNameOrIdCard(keyWord,getUID(),Integer.valueOf(page),Integer.valueOf(pageSize)));
        } catch (Exception e) {
            error(e);
            return error( -1, "查询失败!");
        }
    }
}
}

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

@ -933,7 +933,7 @@ public class ConsultController extends WeixinBaseController {
                                            title = consultSingle.getSymptoms();
                                            title = consultSingle.getSymptoms();
                                        }
                                        }
                                        String repContent = parseContentType(type + "", content);
                                        String repContent = parseContentType(type + "", content);
                                        String first = "居民" + patient.getName() + "的健康咨询有新的回复。";
                                        String first = "居民" + patient.getName() + "的咨询有新的回复。";
                                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                        String url = doctorAssistant + "/wlyy/feldsher/sendDoctorTemplates";
                                        List<NameValuePair> params = new ArrayList<>();
                                        List<NameValuePair> params = new ArrayList<>();
                                        params.add(new BasicNameValuePair("type", "8"));
                                        params.add(new BasicNameValuePair("type", "8"));

+ 12 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/patient/device/PatientDeviceController.java

@ -292,4 +292,16 @@ public class PatientDeviceController extends BaseController {
            return invalidUserException(ex, -1, ex.getMessage());
            return invalidUserException(ex, -1, ex.getMessage());
        }
        }
    }
    }
    @ApiOperation("获取居民的设备任务信息")
    @RequestMapping(value = "getPatientDeviceTaskInfo",method = RequestMethod.POST)
    @ResponseBody
    public String getPatientDeviceTaskInfo(@ApiParam(name = "patientCode",value = "患者code")@RequestParam(value = "patientCode",required = true)String patientCode){
        try {
            return write(200,"执行成功","data",patientDeviceService.getPatientDeviceTaskInfo(patientCode));
        }catch (Exception e){
            return write(-1,"执行失败!");
        }
    }
}
}

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

@ -2165,4 +2165,52 @@ public class EsStatisticsController extends BaseController {
            return error(-1, "查询失败");
            return error(-1, "查询失败");
        }
        }
    }
    }
    @RequestMapping("/lowlevel_device")
    @ApiOperation("设备绑定统计")
    @ResponseBody
    public String lowlevel_device(
            @RequestParam(required = true) String area,
            @RequestParam(required = true) int level,
            @RequestParam(required = true) int sort,
            @RequestParam(required = false) String lowLevel,
            @RequestParam(required = false) String year) {
        try {
            //如果年度是空,按当前时间计算是年度是属于那个年度
            if (org.springframework.util.StringUtils.isEmpty(year)) {
                year = Constant.getNowYear();
            }
            //lowLevel不传默认是 level-1
            if (org.springframework.util.StringUtils.isEmpty(lowLevel)) {
                lowLevel = level - 1 + "";
            }
            return write(200, "查询成功", "data", statisticsESService.getLevelDeviceAndBinding(area, elasticsearchUtil.changeLevel(level), sort, String.valueOf(elasticsearchUtil.changeLevel(Integer.valueOf(lowLevel))), year));
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1, "查询失败");
        }
    }
    /**
     * 获取绑定和发放量的折线图
     *
     * @param startDate
     * @param endDate
     * @param type      0 按周,1 按月
     * @return
     *//*
    @RequestMapping("/getDeviceLine")
    @ResponseBody
    public String getDeviceLine(@RequestParam(required = true) String startDate,
                                 @RequestParam(required = true) String endDate,
                                 @RequestParam(required = true) String type) {
        try {
            return write(200, "查询成功", "data", statisticsESService.getSignCountLineByType(getUID(), type, startDate, endDate));
        } catch (Exception e) {
            error(e);
            return error(-1, "查询失败");
        }
    }*/
}
}

+ 168 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/third/health/bank/CreditsLogController.java

@ -0,0 +1,168 @@
/**
 * Created by nature of king on 2018/5/7.
 */
package com.yihu.wlyy.web.third.health.bank;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.wlyy.service.third.health.bank.CreditLogService;
import com.yihu.wlyy.web.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
 * @author wangzhinan
 * @create 2018-05-07 8:50
 * @desc credit log controller
 **/
@RestController
@RequestMapping(value = "/healthBank",produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@Api(description = "积分处理机制")
public class CreditsLogController extends BaseController {
    @Autowired
    private CreditLogService service;
    /**
     * 查询积分排名
     *
     * @param doctorId
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "/findCreditRanking",method = RequestMethod.POST)
    @ApiOperation("查询积分排名")
    public String getById(@ApiParam(name = "doctorId",value = "医生Id")
                              @RequestParam(name = "doctorId")String doctorId,
                                @ApiParam(name = "page", value = "第几页,从1开始")
                              @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                              @RequestParam(value = "size", required = false)Integer size){
        try {
            return write(200,"查询成功","data",service.selectByRanking(doctorId,page,size));
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
    /**
     * 添加积分
     *
     * @param creditsDetail
     * @return
     */
    @RequestMapping(value = "/insertCredits",method = RequestMethod.POST)
    @ApiOperation("添加积分")
    public String insert(@ApiParam(name = "creditsDetail",value = "居民id集合")
                          @RequestParam(name = "creditsDetail") String creditsDetail){
        try {
            JSONObject object = JSONObject.parseObject(creditsDetail);
            return write(200,"添加成功","data",service.insert(object));
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
    /**
     * find credits log details
     *
     * @param creditsLogDo
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "/selectDetails",method = RequestMethod.POST)
    @ApiOperation("积分详情")
    public String selectByCondition(@ApiParam(name = "creditsLogDo",value = "积分JSON")
                                    @RequestParam(name = "creditsLogDo") String creditsLogDo,
                                    @ApiParam(name = "page", value = "第几页,从1开始")
                                    @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                    @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                    @RequestParam(value = "size", required = false)Integer size){
        try {
            JSONObject object = JSONObject.parseObject(creditsLogDo);
            return write(200,"查询成功","data",service.selectByCondition(object,page,size));
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
    /**
     * 账户积分详情
     *
     * @param creditsDetail
     * @return
     */
    @RequestMapping(value = "/selectAccount",method = RequestMethod.POST)
    @ApiOperation("账户积分情况")
    public String selectAccount(@ApiParam(name = "creditsDetail",value = "积分JSON")
                                    @RequestParam(name = "creditsDetail") String creditsDetail){
        try {
            JSONObject object = JSONObject.parseObject(creditsDetail);
            return write(200,"查询成功","data",service.selectAccount(object));
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
    /**
     * 查询任务完成情况
     *
     * @param task
     * @param page
     * @param size
     * @return
     */
    @RequestMapping(value = "/selectTasks",method = RequestMethod.POST)
    @ApiOperation("任务完成情况")
    public String selectByTask(@ApiParam(name = "task",value = "任务JSON")
                                    @RequestParam(name = "task") String task,
                                    @ApiParam(name = "page", value = "第几页,从1开始")
                                    @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                                    @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                                    @RequestParam(value = "size", required = false)Integer size){
        try {
            JSONObject object = JSONObject.parseObject(task);
            return write(200,"查询成功","data",service.selectByTask(object,page,size));
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
    /**
     *  根据条件查看银行账户信息
     *
     * @param account 银行账户
     * @param page 页码
     * @param size 每页大小
     * @return
     */
    @RequestMapping(value = "/findAccount",method = RequestMethod.POST)
    @ApiOperation("银行账户信息")
    public String selectByAccount(@ApiParam(name = "account",value = "任务JSON")
                               @RequestParam(name = "account") String account,
                               @ApiParam(name = "page", value = "第几页,从1开始")
                               @RequestParam(value = "page", defaultValue = "1",required = false)Integer page,
                               @ApiParam(name = "size",defaultValue = "10",value = ",每页分页大小")
                               @RequestParam(value = "size", required = false)Integer size){
        try {
            JSONObject object = JSONObject.parseObject(account);
            return write(200,"查询成功","data",service.selectByAccount(object,page,size));
        }catch (Exception e){
            error(e);
            return error(-1,e.getMessage());
        }
    }
}

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

@ -36,6 +36,9 @@ im:
#物联网配置
#物联网配置
iot:
iot:
  url: http://192.168.131.24:8088/svr-iot/
  url: http://192.168.131.24:8088/svr-iot/
#健康银行配置
healthBank:
  url: http://localhost:10051/svr-health-bank/
#康复计划配置
#康复计划配置
rehabilitation:
rehabilitation:

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

@ -37,6 +37,9 @@ im:
iot:
iot:
#  url: http://192.168.131.24:8088/svr-iot/
#  url: http://192.168.131.24:8088/svr-iot/
  url: http://localhost:10050/svr-iot/
  url: http://localhost:10050/svr-iot/
#健康银行配置
healthBank:
  url: http://localhost:10051/svr-health-bank/
#康复计划配置
#康复计划配置
rehabilitation:
rehabilitation:

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

@ -31,6 +31,9 @@ im:
#物联网配置
#物联网配置
iot:
iot:
  url: http://172.19.103.33:8088/svr-iot/
  url: http://172.19.103.33:8088/svr-iot/
#健康银行配置
healthBank:
  url: http://172.19.103.33:8660/svr-health-bank/
#康复计划配置
#康复计划配置
rehabilitation:
rehabilitation: