Browse Source

Merge branch 'dev' of yeshijie/patient-co-management into dev

lyr 8 years ago
parent
commit
8defdbfa0b
19 changed files with 2442 additions and 18 deletions
  1. 1 0
      patient-co-figure/pom.xml
  2. 0 4
      patient-co-figure/src/main/java/com/yihu/figure/config/war/ServletInitializer.java
  3. 21 0
      patient-co-figure/src/main/java/com/yihu/figure/dao/HealthIndexDao.java
  4. 10 0
      patient-co-figure/src/main/java/com/yihu/figure/dao/HealthIndexStatisticsDao.java
  5. 10 0
      patient-co-figure/src/main/java/com/yihu/figure/dao/PatientInfoDao.java
  6. 165 0
      patient-co-figure/src/main/java/com/yihu/figure/model/HealthIndex.java
  7. 114 0
      patient-co-figure/src/main/java/com/yihu/figure/model/HealthIndexStatistics.java
  8. 118 0
      patient-co-figure/src/main/java/com/yihu/figure/model/PatientInfo.java
  9. 12 0
      patient-co-figure/src/main/java/com/yihu/figure/service/BaseService.java
  10. 809 0
      patient-co-figure/src/main/java/com/yihu/figure/service/HealthIndexService.java
  11. 16 0
      patient-co-figure/src/main/java/com/yihu/figure/service/HealthIndexStatisticsService.java
  12. 15 0
      patient-co-figure/src/main/java/com/yihu/figure/service/PatientInfoService.java
  13. 192 0
      patient-co-figure/src/main/java/com/yihu/figure/util/Constant.java
  14. 176 0
      patient-co-figure/src/main/java/com/yihu/figure/util/ETLConstantData.java
  15. 192 0
      patient-co-figure/src/main/java/com/yihu/figure/util/IdCardUtil.java
  16. 511 0
      patient-co-figure/src/main/java/com/yihu/figure/web/BaseController.java
  17. 74 0
      patient-co-figure/src/main/java/com/yihu/figure/web/HealthIndexController.java
  18. 1 1
      patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientReservationDao.java
  19. 5 13
      patient-co-wlyy/src/main/java/com/yihu/wlyy/util/HttpUtil.java

+ 1 - 0
patient-co-figure/pom.xml

@ -387,6 +387,7 @@
            <groupId>net.sf.json-lib</groupId>
            <artifactId>json-lib</artifactId>
            <version>2.4</version>
            <classifier>jdk15</classifier>
        </dependency>
        <dependency>
            <groupId>org.springframework.data</groupId>

+ 0 - 4
patient-co-figure/src/main/java/com/yihu/figure/config/war/ServletInitializer.java

@ -1,9 +1,5 @@
package com.yihu.figure.config.war;
import com.yihu.figure.Application;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;
/**
 * Created by Administrator on 2016.10.14.
 */

+ 21 - 0
patient-co-figure/src/main/java/com/yihu/figure/dao/HealthIndexDao.java

@ -0,0 +1,21 @@
/*******************************************************************************
 * Copyright (c) 2005, 2014 springside.github.io
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 *******************************************************************************/
package com.yihu.figure.dao;
import com.yihu.figure.model.HealthIndex;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
public interface HealthIndexDao extends PagingAndSortingRepository<HealthIndex, Long> {
	@Query("select p from HealthIndex p where p.user = ?1")
	List<HealthIndex> findByUser(String user);
	@Query(value = "select * from wlyy_health_index where user=?1 and type =?2 and record_date between ?3 and ?4 order by record_date desc limit 0,1",nativeQuery = true)
	HealthIndex findByPatientAndType(String patient,String type,String startTime,String endTime);
}

+ 10 - 0
patient-co-figure/src/main/java/com/yihu/figure/dao/HealthIndexStatisticsDao.java

@ -0,0 +1,10 @@
package com.yihu.figure.dao;
import com.yihu.figure.model.HealthIndexStatistics;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/3/6.
 */
public interface HealthIndexStatisticsDao extends PagingAndSortingRepository<HealthIndexStatistics, Long> {
}

+ 10 - 0
patient-co-figure/src/main/java/com/yihu/figure/dao/PatientInfoDao.java

@ -0,0 +1,10 @@
package com.yihu.figure.dao;
import com.yihu.figure.model.PatientInfo;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yeshijie on 2017/3/6.
 */
public interface PatientInfoDao extends PagingAndSortingRepository<PatientInfo, Long> {
}

+ 165 - 0
patient-co-figure/src/main/java/com/yihu/figure/model/HealthIndex.java

@ -0,0 +1,165 @@
package com.yihu.figure.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 健康指标
 * @author ysj
 *
 */
@Entity
@Table(name = "wlyy_health_index")
public class HealthIndex extends IdEntity {
	// 患者标志
	private String user;
	// 血糖/收缩压/体重/腰围/早餐前空腹
	private String value1;
	// 舒张压/早餐后空腹
	private String value2;
	// 午餐空腹
	private String value3;
	// 午餐后
	private String value4;
	// 晚餐空腹
	private String value5;
	// 晚餐后
	private String value6;
	// 睡前
	private String value7;
	// 健康指标类型(1血糖,2血压,3体重,4腰围)
	private int type;
	// 记录时间
	private Date recordDate;
	// 添加时间
	private Date czrq;
	// 是否作废,1正常,0作废
	private String del;
	//身份证号码
	private String idcard;
	//设备编号
	private String deviceSn;
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public String getValue1() {
		return value1;
	}
	public void setValue1(String value1) {
		this.value1 = value1;
	}
	public String getValue2() {
		return value2;
	}
	public void setValue2(String value2) {
		this.value2 = value2;
	}
	public String getValue3() {
		return value3;
	}
	public void setValue3(String value3) {
		this.value3 = value3;
	}
	public String getValue4() {
		return value4;
	}
	public void setValue4(String value4) {
		this.value4 = value4;
	}
	public String getValue5() {
		return value5;
	}
	public void setValue5(String value5) {
		this.value5 = value5;
	}
	public String getValue6() {
		return value6;
	}
	public void setValue6(String value6) {
		this.value6 = value6;
	}
	public String getValue7() {
		return value7;
	}
	public void setValue7(String value7) {
		this.value7 = value7;
	}
	@Column(name = "record_date")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	public Date getRecordDate() {
		return recordDate;
	}
	public void setRecordDate(Date recordDate) {
		this.recordDate = recordDate;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	@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 getDel() {
		return del;
	}
	public void setDel(String del) {
		this.del = del;
	}
	@Column(name = "Idcard")
	public String getIdcard() {
		return idcard;
	}
	public void setIdcard(String idcard) {
		this.idcard = idcard;
	}
	@Column(name = "device_sn")
	public String getDeviceSn() {
		return deviceSn;
	}
	public void setDeviceSn(String deviceSn) {
		this.deviceSn = deviceSn;
	}
}

+ 114 - 0
patient-co-figure/src/main/java/com/yihu/figure/model/HealthIndexStatistics.java

@ -0,0 +1,114 @@
package com.yihu.figure.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 健康指标
 * @author ysj
 *
 */
@Entity
@Table(name = "wlyy_health_index_statistics")
public class HealthIndexStatistics extends IdEntity {
	// 患者标志
	private String user;
	// (血糖/血压)偏高(心率不齐)
	private Integer high;
	// (血糖/血压)正常(心率齐)
	private Integer normal;
	// (血糖/血压)偏低
	private Integer low;
	// 健康指标类型(1血糖,2血压)
	private Integer type;
	//测试类型(1空腹血糖 2早餐后血糖 3午餐前血糖 4午餐后血糖 5晚餐前血糖 6晚餐后血糖 7睡前血糖,8舒张压,9收缩压,10心率)
	private Integer bloodType;
	//时间类型
	private Integer timeType;
	// 添加时间
	private Date czrq;
	public HealthIndexStatistics() {
	}
	public HealthIndexStatistics(String user, Integer high, Integer normal, Integer low, Integer type, Integer bloodType, Integer timeType, Date czrq) {
		this.user = user;
		this.high = high;
		this.normal = normal;
		this.low = low;
		this.type = type;
		this.bloodType = bloodType;
		this.timeType = timeType;
		this.czrq = czrq;
	}
	public String getUser() {
		return user;
	}
	public void setUser(String user) {
		this.user = user;
	}
	public Integer getHigh() {
		return high;
	}
	public void setHigh(Integer high) {
		this.high = high;
	}
	public Integer getNormal() {
		return normal;
	}
	public void setNormal(Integer normal) {
		this.normal = normal;
	}
	public Integer getLow() {
		return low;
	}
	public void setLow(Integer low) {
		this.low = low;
	}
	public Integer getBloodType() {
		return bloodType;
	}
	public void setBloodType(Integer bloodType) {
		this.bloodType = bloodType;
	}
	public Integer getTimeType() {
		return timeType;
	}
	public void setTimeType(Integer timeType) {
		this.timeType = timeType;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	@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;
	}
}

+ 118 - 0
patient-co-figure/src/main/java/com/yihu/figure/model/PatientInfo.java

@ -0,0 +1,118 @@
package com.yihu.figure.model;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
/**
 * Created by yeshijie on 2017/3/6.
 */
@Entity
@Table(name = "wlyy_patient")
public class PatientInfo extends IdEntity implements Serializable{
    // 业务主键
    private String code;
    // 身份证号
    private String idcard;
    // 姓名
    private String name;
    // 生日
    private Date birthday;
    // 性別,1男,2女
    private Integer sex;
    // 手機號
    private String mobile;
    // 社保卡號
    private String ssc;
    // 城市代碼
    private String city;
    // 地址
    private String address;
    // 更新時間
    private Date createTime;
    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 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 getSsc() {
        return ssc;
    }
    public void setSsc(String ssc) {
        this.ssc = ssc;
    }
    public String getCity() {
        return city;
    }
    public void setCity(String city) {
        this.city = city;
    }
    public String getAddress() {
        return address;
    }
    public void setAddress(String address) {
        this.address = address;
    }
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}

+ 12 - 0
patient-co-figure/src/main/java/com/yihu/figure/service/BaseService.java

@ -0,0 +1,12 @@
package com.yihu.figure.service;
import java.util.UUID;
public class BaseService {
	public String getCode() {
		return UUID.randomUUID().toString().replaceAll("-", "");
	}
}

+ 809 - 0
patient-co-figure/src/main/java/com/yihu/figure/service/HealthIndexService.java

@ -0,0 +1,809 @@
package com.yihu.figure.service;
import com.yihu.figure.dao.HealthIndexDao;
import com.yihu.figure.dao.HealthIndexStatisticsDao;
import com.yihu.figure.model.HealthIndex;
import com.yihu.figure.model.HealthIndexStatistics;
import com.yihu.figure.util.DateUtil;
import com.yihu.figure.util.ETLConstantData;
import com.yihu.figure.util.IdCardUtil;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
import java.text.DecimalFormat;
import java.util.*;
/**
 * 居民体征
 *
 * @author ysj add 2017-03-06
 */
@Component
@Transactional(rollbackOn = Exception.class)
public class HealthIndexService extends BaseService {
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private HealthIndexDao healthIndexDao;
    @Autowired
    private HealthIndexStatisticsDao healthIndexStatisticsDao;
    private DecimalFormat df = new DecimalFormat("#.0");
    /**
     * 获取居民体征数据
     * @param patient
     * @param type
     * @return
     */
    public JSONObject healthIndex(String patient, String type, String bloodType, String timeType) throws Exception{
        JSONObject json = new JSONObject();
        int limit = 1;
        if("1".equals(timeType)){
            limit = 30;
        }else if("2".equals(timeType)){
            limit = 182;
        }else if("3".equals(timeType)){
            limit = 365;
        }
        String sql1 = "select date_format(record_date,'%Y-%c-%d %H:%i:%s') recordDate, ";
        if("1".equals(type)){
            //血糖
            sql1 += "value1 value  " +
                   "from wlyy_health_index " +
                   "where user = '"+patient+"' " +
                   "and type="+type+" " +
                   "and value2='"+bloodType+"' " +
                   "order by record_date desc " +
                   "limit "+limit;
        }else{
            //血压
            if("9".equals(bloodType)){
                sql1 +=" value1 value ";
            }else if("8".equals(bloodType)){
                sql1 +=" value2 value ";
            }else if("10".equals(bloodType)){
                sql1 +=" value3 value ";
            }
            sql1 += "from wlyy_health_index " +
                    "where user = '"+patient+"' " +
                    "and type="+type+" " +
                    "order by record_date desc " +
                    "limit "+limit;
        }
        List<Map<String,Object>> list1 = jdbcTemplate.queryForList(sql1);
        //
        String sql2 = "select high,normal,low  " +
                "from wlyy_health_index_statistics " +
                "where user = '"+patient+"' " +
                "and time_type="+timeType+" " +
                "and blood_type='"+bloodType+"' " +
                "limit 1";
        List<Map<String,Object>> list2 = jdbcTemplate.queryForList(sql2);
        Map<String,Object> map = null;
        if(list2.size()>0){
            map = list2.get(0);
        }else{
            map = new HashMap<>();
            map.put("high",0);
            map.put("normal",0);
            map.put("low",0);
        }
        json.put("healths",list1);
        json.put("statistics",map);
        return json;
    }
    /**
     * 自动生成居民一年的体征数据
     * @param patient
     */
    public void autoHealthIndex(String patient,String type) throws Exception{
        String sql = "select code,idcard,ssc  from wlyy_patient_info where code = '"+patient+"'";
        List<Map<String,Object>> list = jdbcTemplate.queryForList(sql);
        if(list.size()>0){
            Map<String,Object> map = list.get(0);
            String idcard = map.get("idcard").toString();
            int age = IdCardUtil.getAgeForIdcard(idcard);
            String sex = IdCardUtil.getSexForIdcard(idcard);//1女 2男 3未知
            // 健康指标类型(1血糖,2血压,3体重,4腰围)
            List<HealthIndex> patientHealthIndexList = new ArrayList<>();
            if(StringUtils.isEmpty(type)){
                xuetang(patient,null,idcard,patientHealthIndexList);
                xueya(patient,null,idcard,age,sex,patientHealthIndexList);
                weight(patient,null,idcard,age,sex,patientHealthIndexList);
                yaowei(patient,null,idcard,age,sex,patientHealthIndexList);
            }else if("1".equals(type)){
                xuetang(patient,null,idcard,patientHealthIndexList);
            }else if("2".equals(type)){
                xueya(patient,null,idcard,age,sex,patientHealthIndexList);
            }else if("3".equals(type)){
                weight(patient,null,idcard,age,sex,patientHealthIndexList);
            }else if("4".equals(type)){
                yaowei(patient,null,idcard,age,sex,patientHealthIndexList);
            }
            System.out.println(patientHealthIndexList.size());
            healthIndexDao.save(patientHealthIndexList);
        }
    }
    /**
     * 血糖
     * @param patient
     * @param deviceSn
     * @param idcard
     */
    public List<HealthIndex> xuetang(String patient, String deviceSn, String idcard, List<HealthIndex> list){
        String startTime = DateUtil.getStringDateShort()+" 00:00:00";
        String endTime = DateUtil.getStringDateShort()+" 23:59:59";
        HealthIndex healthIndex = healthIndexDao.findByPatientAndType(patient,"1",startTime,endTime);
        if(healthIndex!=null){//判断是否已经生成过数据
            return list;
        }
        Calendar cal = Calendar.getInstance();
        String fasting = "07:00:00";
        String afterBreakfast = "09:00:00";
        String beforeLunch = "11:00:00";
        String afterLunch = "13:00:00";
        String beforeDinner = "17:00:00";
        String afterDinner = "19:00:00";
        String beforeSleep = "23:00:00";
        double value1,value2,value3,value4,value5,value6,value7;
        //value2 1空腹血糖 2早餐后血糖 3午餐前血糖 4午餐后血糖 5晚餐前血糖 6晚餐后血糖 7睡前血糖
        //≥7.0 mmol/l或餐后血糖≥11.1 mmol/l 属于糖尿病
        HealthIndex healthIndex1 = null;
        HealthIndex healthIndex2 = null;
        HealthIndex healthIndex3 = null;
        HealthIndex healthIndex4 = null;
        HealthIndex healthIndex5 = null;
        HealthIndex healthIndex6 = null;
        HealthIndex healthIndex7 = null;
        int month = 30;//一个月取30天
        int halfYear = 182;//半年取182天
        double high = 11.1,normal=7.0,low = 4.0;//(空腹4.0-7.0为正常,餐后7.0-11.0为正常)
        int high11=0,normal11=0,low11=0,high12=0,normal12=0,low12=0,high13=0,normal13=0,low13=0;//1为近一个月,2为近半年,3为近一年
        int high21=0,normal21=0,low21=0,high22=0,normal22=0,low22=0,high23=0,normal23=0,low23=0;//1为近一个月,2为近半年,3为近一年
        int high31=0,normal31=0,low31=0,high32=0,normal32=0,low32=0,high33=0,normal33=0,low33=0;//1为近一个月,2为近半年,3为近一年
        int high41=0,normal41=0,low41=0,high42=0,normal42=0,low42=0,high43=0,normal43=0,low43=0;//1为近一个月,2为近半年,3为近一年
        int high51=0,normal51=0,low51=0,high52=0,normal52=0,low52=0,high53=0,normal53=0,low53=0;//1为近一个月,2为近半年,3为近一年
        int high61=0,normal61=0,low61=0,high62=0,normal62=0,low62=0,high63=0,normal63=0,low63=0;//1为近一个月,2为近半年,3为近一年
        int high71=0,normal71=0,low71=0,high72=0,normal72=0,low72=0,high73=0,normal73=0,low73=0;//1为近一个月,2为近半年,3为近一年
        Random random = new Random();
        List<HealthIndexStatistics> statisticsList = new ArrayList<>();
        for (int i = 0;i<365;i++){
            value1 = 6.0;
            value2 = 10.0;
            value3 = 6.0;
            value4 = 10.0;
            value5 = 6.0;
            value6 = 10.0;
            value7 = 6.0;
            healthIndex1 = new HealthIndex();
            healthIndex2 = new HealthIndex();
            healthIndex3 = new HealthIndex();
            healthIndex4 = new HealthIndex();
            healthIndex5 = new HealthIndex();
            healthIndex6 = new HealthIndex();
            healthIndex7 = new HealthIndex();
            Date recordDate = cal.getTime();
            if(random.nextInt(2)==1){
                //加
                value1 += random3ten(random);
            }else{
                //减
                value1 -= random2ten(random);
            }
            healthIndex1.setCzrq(new Date());
            healthIndex1.setDel("1");
            healthIndex1.setDeviceSn(deviceSn);
            healthIndex1.setIdcard(idcard);
            healthIndex1.setRecordDate(recordDate);
            healthIndex1.setType(1);
            healthIndex1.setUser(patient);
            healthIndex1.setValue1(df.format(value1));
            healthIndex1.setValue2("1");
            if(random.nextInt(2)==1){
                //加
                value2 += random3ten(random);
            }else{
                //减
                value2 -= random2ten(random);
            }
            healthIndex2.setCzrq(new Date());
            healthIndex2.setDel("1");
            healthIndex2.setDeviceSn(deviceSn);
            healthIndex2.setIdcard(idcard);
            healthIndex2.setRecordDate(recordDate);
            healthIndex2.setType(1);
            healthIndex2.setUser(patient);
            healthIndex2.setValue1(df.format(value2));
            healthIndex2.setValue2("2");
            if(random.nextInt(2)==1){
                //加
                value3 += random3ten(random);
            }else{
                //减
                value3 -= random2ten(random);
            }
            healthIndex3.setCzrq(new Date());
            healthIndex3.setDel("1");
            healthIndex3.setDeviceSn(deviceSn);
            healthIndex3.setIdcard(idcard);
            healthIndex3.setRecordDate(recordDate);
            healthIndex3.setType(1);
            healthIndex3.setUser(patient);
            healthIndex3.setValue1(df.format(value3));
            healthIndex3.setValue2("3");
            if(random.nextInt(2)==1){
                //加
                value4 += random3ten(random);
            }else{
                //减
                value4 -= random2ten(random);
            }
            healthIndex4.setCzrq(new Date());
            healthIndex4.setDel("1");
            healthIndex4.setDeviceSn(deviceSn);
            healthIndex4.setIdcard(idcard);
            healthIndex4.setRecordDate(recordDate);
            healthIndex4.setType(1);
            healthIndex4.setUser(patient);
            healthIndex4.setValue1(df.format(value4));
            healthIndex4.setValue2("4");
            if(random.nextInt(2)==1){
                //加
                value5 += random3ten(random);
            }else{
                //减
                value5 -= random2ten(random);
            }
            healthIndex5.setCzrq(new Date());
            healthIndex5.setDel("1");
            healthIndex5.setDeviceSn(deviceSn);
            healthIndex5.setIdcard(idcard);
            healthIndex5.setRecordDate(recordDate);
            healthIndex5.setType(1);
            healthIndex5.setUser(patient);
            healthIndex5.setValue1(df.format(value5));
            healthIndex5.setValue2("5");
            if(random.nextInt(2)==1){
                //加
                value6 += random3ten(random);
            }else{
                //减
                value6 -= random2ten(random);
            }
            healthIndex6.setCzrq(new Date());
            healthIndex6.setDel("1");
            healthIndex6.setDeviceSn(deviceSn);
            healthIndex6.setIdcard(idcard);
            healthIndex6.setRecordDate(recordDate);
            healthIndex6.setType(1);
            healthIndex6.setUser(patient);
            healthIndex6.setValue1(df.format(value6));
            healthIndex6.setValue2("6");
            if(random.nextInt(2)==1){
                //加
                value7 += random3ten(random);
            }else{
                //减
                value7 -= random2ten(random);
            }
            healthIndex7.setCzrq(new Date());
            healthIndex7.setDel("1");
            healthIndex7.setDeviceSn(deviceSn);
            healthIndex7.setIdcard(idcard);
            healthIndex7.setRecordDate(recordDate);
            healthIndex7.setType(1);
            healthIndex7.setUser(patient);
            healthIndex7.setValue1(df.format(value7));
            healthIndex7.setValue2("7");
            //统计数据
            int flag1 = ETLConstantData.xueTangBefore(value1);
            int flag2 = ETLConstantData.xueTangAfter(value2);
            int flag3 = ETLConstantData.xueTangBefore(value3);
            int flag4 = ETLConstantData.xueTangAfter(value4);
            int flag5 = ETLConstantData.xueTangBefore(value5);
            int flag6 = ETLConstantData.xueTangAfter(value6);
            int flag7 = ETLConstantData.xueTangBefore(value7);
            if(flag1>0){
                high11 += i<month?1:0;
                high12 += i<halfYear?1:0;
                high13 ++;
            }else if(flag1<0){
                low11 += i<month?1:0;
                low12 += i<halfYear?1:0;
                low13 ++;
            }else {
                //正常
                normal11 += i<month?1:0;
                normal12 += i<halfYear?1:0;
                normal13 ++;
            }
            if(flag2>0){
                high21 += i<month?1:0;
                high22 += i<halfYear?1:0;
                high23 ++;
            }else if(flag2<0){
                low21 += i<month?1:0;
                low22 += i<halfYear?1:0;
                low23 ++;
            }else {
                //正常
                normal21 += i<month?1:0;
                normal22 += i<halfYear?1:0;
                normal23 ++;
            }
            if(flag3>0){
                high31 += i<month?1:0;
                high32 += i<halfYear?1:0;
                high33 ++;
            }else if(flag3<0){
                low31 += i<month?1:0;
                low32 += i<halfYear?1:0;
                low33 ++;
            }else {
                //正常
                normal31 += i<month?1:0;
                normal32 += i<halfYear?1:0;
                normal33 ++;
            }
            if(flag4>0){
                high41 += i<month?1:0;
                high42 += i<halfYear?1:0;
                high43 ++;
            }else if(flag4<0){
                low41 += i<month?1:0;
                low42 += i<halfYear?1:0;
                low43 ++;
            }else {
                //正常
                normal41 += i<month?1:0;
                normal42 += i<halfYear?1:0;
                normal43 ++;
            }
            if(flag5>0){
                high51 += i<month?1:0;
                high52 += i<halfYear?1:0;
                high53 ++;
            }else if(flag5<0){
                low51 += i<month?1:0;
                low52 += i<halfYear?1:0;
                low53 ++;
            }else {
                //正常
                normal51 += i<month?1:0;
                normal52 += i<halfYear?1:0;
                normal53 ++;
            }
            if(flag6>0){
                high61 += i<month?1:0;
                high62 += i<halfYear?1:0;
                high63 ++;
            }else if(flag6<0){
                low61 += i<month?1:0;
                low62 += i<halfYear?1:0;
                low63 ++;
            }else {
                //正常
                normal61 += i<month?1:0;
                normal62 += i<halfYear?1:0;
                normal63 ++;
            }
            if(flag7>0){
                high71 += i<month?1:0;
                high72 += i<halfYear?1:0;
                high73 ++;
            }else if(flag7<0){
                low71 += i<month?1:0;
                low72 += i<halfYear?1:0;
                low73 ++;
            }else {
                //正常
                normal71 += i<month?1:0;
                normal72 += i<halfYear?1:0;
                normal73 ++;
            }
            if(i==29){
                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high11,normal11,low11,1,1,1,new Date());
                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high21,normal21,low21,1,2,1,new Date());
                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high31,normal31,low31,1,3,1,new Date());
                HealthIndexStatistics healthIndexStatistics4 = new HealthIndexStatistics(patient,high41,normal41,low41,1,4,1,new Date());
                HealthIndexStatistics healthIndexStatistics5 = new HealthIndexStatistics(patient,high51,normal51,low51,1,5,1,new Date());
                HealthIndexStatistics healthIndexStatistics6 = new HealthIndexStatistics(patient,high61,normal61,low61,1,6,1,new Date());
                HealthIndexStatistics healthIndexStatistics7 = new HealthIndexStatistics(patient,high71,normal71,low71,1,7,1,new Date());
                statisticsList.add(healthIndexStatistics1);
                statisticsList.add(healthIndexStatistics2);
                statisticsList.add(healthIndexStatistics3);
                statisticsList.add(healthIndexStatistics4);
                statisticsList.add(healthIndexStatistics5);
                statisticsList.add(healthIndexStatistics6);
                statisticsList.add(healthIndexStatistics7);
            }
            if(i==181){
                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high12,normal12,low12,1,1,2,new Date());
                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high22,normal22,low22,1,2,2,new Date());
                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high32,normal32,low32,1,3,2,new Date());
                HealthIndexStatistics healthIndexStatistics4 = new HealthIndexStatistics(patient,high42,normal42,low42,1,4,2,new Date());
                HealthIndexStatistics healthIndexStatistics5 = new HealthIndexStatistics(patient,high52,normal52,low52,1,5,2,new Date());
                HealthIndexStatistics healthIndexStatistics6 = new HealthIndexStatistics(patient,high62,normal62,low62,1,6,2,new Date());
                HealthIndexStatistics healthIndexStatistics7 = new HealthIndexStatistics(patient,high72,normal72,low72,1,7,2,new Date());
                statisticsList.add(healthIndexStatistics1);
                statisticsList.add(healthIndexStatistics2);
                statisticsList.add(healthIndexStatistics3);
                statisticsList.add(healthIndexStatistics4);
                statisticsList.add(healthIndexStatistics5);
                statisticsList.add(healthIndexStatistics6);
                statisticsList.add(healthIndexStatistics7);
            }
            if(i==364){
                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high13,normal13,low13,1,1,3,new Date());
                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high23,normal23,low23,1,2,3,new Date());
                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high33,normal33,low33,1,3,3,new Date());
                HealthIndexStatistics healthIndexStatistics4 = new HealthIndexStatistics(patient,high43,normal43,low43,1,4,3,new Date());
                HealthIndexStatistics healthIndexStatistics5 = new HealthIndexStatistics(patient,high53,normal53,low53,1,5,3,new Date());
                HealthIndexStatistics healthIndexStatistics6 = new HealthIndexStatistics(patient,high63,normal63,low63,1,6,3,new Date());
                HealthIndexStatistics healthIndexStatistics7 = new HealthIndexStatistics(patient,high73,normal73,low73,1,7,3,new Date());
                statisticsList.add(healthIndexStatistics1);
                statisticsList.add(healthIndexStatistics2);
                statisticsList.add(healthIndexStatistics3);
                statisticsList.add(healthIndexStatistics4);
                statisticsList.add(healthIndexStatistics5);
                statisticsList.add(healthIndexStatistics6);
                statisticsList.add(healthIndexStatistics7);
            }
            list.add(healthIndex1);
            list.add(healthIndex2);
            list.add(healthIndex3);
            list.add(healthIndex4);
            list.add(healthIndex5);
            list.add(healthIndex6);
            list.add(healthIndex7);
            cal.add(Calendar.DAY_OF_YEAR,-1);
        }
        healthIndexStatisticsDao.save(statisticsList);
        return list;
    }
    /**
     * 血压
     * @param patient
     * @param deviceSn
     * @param idcard
     */
    public List<HealthIndex> xueya(String patient, String deviceSn, String idcard, int age, String sex, List<HealthIndex> list){
        String startTime = DateUtil.getStringDateShort()+" 00:00:00";
        String endTime = DateUtil.getStringDateShort()+" 23:59:59";
        HealthIndex healthIndex = healthIndexDao.findByPatientAndType(patient,"2",startTime,endTime);
        if(healthIndex!=null){//判断是否已经生成过数据
            return list;
        }
        Calendar cal = Calendar.getInstance();
        int value1,value2,value3,value4,intValue1,intValue2;
        //140/90mmHg至160/95mmHg之间,不能确定为高血压
        //成年人收缩压90-139.舒张压60-89为正常
        int high=140,normal=90,low=60;
        int high11=0,normal11=0,low11=0,high12=0,normal12=0,low12=0,high13=0,normal13=0,low13=0;//1为近一个月,2为近半年,3为近一年
        int high21=0,normal21=0,low21=0,high22=0,normal22=0,low22=0,high23=0,normal23=0,low23=0;//1为近一个月,2为近半年,3为近一年
        int high31=0,normal31=0,low31=0,high32=0,normal32=0,low32=0,high33=0,normal33=0,low33=0;//1为近一个月,2为近半年,3为近一年
        Random random = new Random();
        int month = 30;//一个月取30天
        int halfYear = 182;//半年取182天
        age = age>65?65:age;
        if("2".equals(sex)){
            intValue1 = 82+age;
            if(random.nextInt(2)==0){
                intValue2 = 84+random.nextInt(3);
            }else{
                intValue2 = 84-random.nextInt(3);
            }
        }else{
            intValue1 = 80+age;
            if(random.nextInt(2)==0){
                intValue2 = 81+random.nextInt(3);
            }else{
                intValue2 = 81-random.nextInt(3);
            }
        }
        List<HealthIndexStatistics> statisticsList = new ArrayList<>();
        for (int i = 0;i<365;i++){
            value1 = intValue1;//收缩压
            value2 = intValue2;//舒张压
            healthIndex = new HealthIndex();
            Date recordDate = cal.getTime();
            int temp = random.nextInt(10);
            if(temp<5){
                value1 += random.nextInt(21);
                value2 += random.nextInt(6);
            }else if(temp>7){
                value1 += 40+ random.nextInt(10);
                value2 += 15 + random.nextInt(5);
            }else{
                value1 += 20+ random.nextInt(21);
                value2 += 10 + random.nextInt(6);
            }
            value3 = random.nextInt(2)==1?(value2+random.nextInt(9)):(value2-random.nextInt(9));//心率
            value4 = random.nextInt(100)>96?1:0;//心率是否不齐
            //统计数据
            int flag1 = ETLConstantData.ssy(value1);
            int flag2 = ETLConstantData.szy(value2);
            int flag3 = ETLConstantData.heartRate(value3);
            if(flag1>0){
                high11 += i<month?1:0;
                high12 += i<halfYear?1:0;
                high13 ++;
            }else if(flag1<0){
                low11 += i<month?1:0;
                low12 += i<halfYear?1:0;
                low13 ++;
            }else{
                normal11 += i<month?1:0;
                normal12 += i<halfYear?1:0;
                normal13 ++;
            }
            if(flag2>0){
                high21 += i<month?1:0;
                high22 += i<halfYear?1:0;
                high23 ++;
            }else if(flag2<0){
                low21 += i<month?1:0;
                low22 += i<halfYear?1:0;
                low23 ++;
            }else{
                normal21 += i<month?1:0;
                normal22 += i<halfYear?1:0;
                normal23 ++;
            }
            if(flag3>0){
                high31 += i<month?1:0;
                high32 += i<halfYear?1:0;
                high33 ++;
            }
//            else if(flag3<0){
//                low31 += i<month?1:0;
//                low31 += i<halfYear?1:0;
//                low31 ++;
//            }
            else{
                normal31 += i<month?1:0;
                normal32 += i<halfYear?1:0;
                normal33 ++;
            }
            if(i==29){
                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high11,normal11,low11,2,8,1,new Date());
                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high21,normal21,low21,2,9,1,new Date());
                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high31,normal31,low31,2,10,1,new Date());
                statisticsList.add(healthIndexStatistics1);
                statisticsList.add(healthIndexStatistics2);
                statisticsList.add(healthIndexStatistics3);
            }
            if(i==181){
                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high12,normal12,low12,2,8,2,new Date());
                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high22,normal22,low22,2,9,2,new Date());
                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high32,normal32,low32,2,10,2,new Date());
                statisticsList.add(healthIndexStatistics1);
                statisticsList.add(healthIndexStatistics2);
                statisticsList.add(healthIndexStatistics3);
            }
            if(i==364){
                HealthIndexStatistics healthIndexStatistics1 = new HealthIndexStatistics(patient,high13,normal13,low13,2,8,3,new Date());
                HealthIndexStatistics healthIndexStatistics2 = new HealthIndexStatistics(patient,high23,normal23,low23,2,9,3,new Date());
                HealthIndexStatistics healthIndexStatistics3 = new HealthIndexStatistics(patient,high33,normal33,low33,2,10,3,new Date());
                statisticsList.add(healthIndexStatistics1);
                statisticsList.add(healthIndexStatistics2);
                statisticsList.add(healthIndexStatistics3);
            }
            healthIndex.setCzrq(new Date());
            healthIndex.setDel("1");
            healthIndex.setDeviceSn(deviceSn);
            healthIndex.setIdcard(idcard);
            healthIndex.setRecordDate(recordDate);
            healthIndex.setType(2);
            healthIndex.setUser(patient);
            healthIndex.setValue1(String.valueOf(value1));
            healthIndex.setValue2(String.valueOf(value2));
            healthIndex.setValue3(String.valueOf(value3));
            healthIndex.setValue4(String.valueOf(value4));
            list.add(healthIndex);
            cal.add(Calendar.DAY_OF_YEAR,-1);
        }
        healthIndexStatisticsDao.save(statisticsList);
        return list;
    }
    /**
     * 体重
     * @param patient
     * @param deviceSn
     * @param idcard
     */
    public List<HealthIndex> weight(String patient, String deviceSn, String idcard, int age, String sex, List<HealthIndex> list){
        String startTime = DateUtil.getStringDateShort()+" 00:00:00";
        String endTime = DateUtil.getStringDateShort()+" 23:59:59";
        HealthIndex healthIndex = healthIndexDao.findByPatientAndType(patient,"3",startTime,endTime);
        if(healthIndex!=null){//判断是否已经生成过数据
            return list;
        }
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.HOUR_OF_DAY,0);
        cal.set(Calendar.MINUTE,0);
        cal.set(Calendar.SECOND,0);
        double weiht = 0;
        if(age<=19){
            weiht = "2".equals(sex)?55.4:49.2;
        }else if(age>=20&&age<=24){
            weiht = "2".equals(sex)?57.3:50.8;
        }else if(age>=25&&age<=29){
            weiht = "2".equals(sex)?58.4:52.0;
        }else if(age>=30&&age<=34){
            weiht = "2".equals(sex)?59.8:53.0;
        }else if(age>=35&&age<=39){
            weiht = "2".equals(sex)?61.0:54.1;
        }else if(age>=40&&age<=44){
            weiht = "2".equals(sex)?62.6:55.5;
        }else if(age>=45&&age<=49){
            weiht = "2".equals(sex)?63.1:56.0;
        }else if(age>=50&&age<=60){
            weiht = "2".equals(sex)?63.1:56.0;
        }else{
            weiht = "2".equals(sex)?60.4:55.1;
        }
        double weight = weiht;
        Random random = new Random();
        int top = random.nextInt(4);
        for (int i = 0;i<52;i++){
            healthIndex = new HealthIndex();
            Date recordDate = cal.getTime();
            if(top==0){
                weiht += 0.1;
            }else if(top==1){
                if(i<26){
                    weiht += randomTen(random);
                }else{
                    weiht -= randomTen(random);
                }
            }else if(top==2){
                if(i<13){
                    weiht += randomTen(random);
                }else if(i<26){
                    weiht -= randomTen(random);
                }else if(i<39){
                    weiht += randomTen(random);
                }else{
                    weiht -= randomTen(random);
                }
            }else if(top==3){
                if(i<10){
                    weiht += randomTen(random);
                }else if(i<20){
                    weiht -= randomTen(random);
                }else if(i<32){
                    weiht += randomTen(random);
                }else if(i<44){
                    weiht -= randomTen(random);
                }else{
                    weiht += randomTen(random);
                }
            }
            healthIndex.setCzrq(new Date());
            healthIndex.setDel("1");
            healthIndex.setDeviceSn(deviceSn);
            healthIndex.setIdcard(idcard);
            healthIndex.setRecordDate(recordDate);
            healthIndex.setType(3);
            healthIndex.setUser(patient);
            healthIndex.setValue1(df.format(weiht));
            list.add(healthIndex);
            cal.add(Calendar.DAY_OF_YEAR,-7);
        }
        return list;
    }
    public double randomTen(Random random){
        int i = random.nextInt(5);
        return i==0?0:i/10.0;
    }
    public double random2ten(Random random){
        int i = random.nextInt(20);
        return i==0?0:i/10.0;
    }
    public double random3ten(Random random){
        int i = random.nextInt(30);
        return i==0?0:i/10.0;
    }
    public static void main(String[] args) {
        Random random = new Random();
        int in = 10;
        for (int i = 0;i<20;i++){
            in += random.nextInt(10);
            System.out.println(in);
        }
    }
    /**
     * 腰围
     * @param patient
     * @param deviceSn
     * @param idcard
     */
    public List<HealthIndex> yaowei(String patient, String deviceSn, String idcard, int age, String sex, List<HealthIndex> list){
        String startTime = DateUtil.getStringDateShort()+" 00:00:00";
        String endTime = DateUtil.getStringDateShort()+" 23:59:59";
        HealthIndex healthIndex = healthIndexDao.findByPatientAndType(patient,"4",startTime,endTime);
        if(healthIndex!=null){//判断是否已经生成过数据
            return list;
        }
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.HOUR_OF_DAY,0);
        cal.set(Calendar.MINUTE,0);
        cal.set(Calendar.SECOND,0);
        double yaowei = "2".equals(sex)?86:78;
        Random random = new Random();
        for (int i = 0;i<52;i++){
            healthIndex = new HealthIndex();
            Date recordDate = cal.getTime();
            int j = random.nextInt(7);
            if(j==0){
            }else{
                yaowei = j%2==0?yaowei+0.3:yaowei-0.3;
            }
            healthIndex.setCzrq(new Date());
            healthIndex.setDel("1");
            healthIndex.setDeviceSn(deviceSn);
            healthIndex.setIdcard(idcard);
            healthIndex.setRecordDate(recordDate);
            healthIndex.setType(4);
            healthIndex.setUser(patient);
            healthIndex.setValue1(df.format(yaowei));
            list.add(healthIndex);
            cal.add(Calendar.DAY_OF_YEAR,-7);
        }
        return list;
    }
}

+ 16 - 0
patient-co-figure/src/main/java/com/yihu/figure/service/HealthIndexStatisticsService.java

@ -0,0 +1,16 @@
package com.yihu.figure.service;
import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
/**
 * 体征统计
 * Created by yeshijie on 2017/3/6.
 */
@Component
@Transactional(rollbackOn = Exception.class)
public class HealthIndexStatisticsService extends BaseService {
}

+ 15 - 0
patient-co-figure/src/main/java/com/yihu/figure/service/PatientInfoService.java

@ -0,0 +1,15 @@
package com.yihu.figure.service;
import com.yihu.figure.dao.PatientInfoDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
 * Created by yeshijie on 2017/3/6.
 */
@Service
public class PatientInfoService extends BaseService{
    @Autowired
    private PatientInfoDao patientInfoDao;
}

+ 192 - 0
patient-co-figure/src/main/java/com/yihu/figure/util/Constant.java

@ -0,0 +1,192 @@
package com.yihu.figure.util;
/**
 * Created by Administrator on 2016.08.18.
 * 常量类
 */
public class Constant {
    public static String city="350200";
    public static String cityName="厦门市";
    //二级维度的性别
    public static String level_sex_1="1";
    public static String level_sex_2="2";
    public static String level_sex_3="3";
    public static String level_sex_1_name="女";
    public static String level_sex_2_name="男";
    public static String level_sex_3_name="未知";
    //二级维度的年龄
    public static String level_age_1="1";
    public static String level_age_2="2";
    public static String level_age_3="3";
    public static String level_age_4="4";
    public static String level_age_5="5";
    public static String level_age_6="6";
    public static String level_age_1_name="0~6";
    public static String level_age_2_name="7~18";
    public static String level_age_3_name="19~30";
    public static String level_age_4_name="31~50";
    public static String level_age_5_name="51~65";
    public static String level_age_6_name=">65";
    //二级维度的组
    public static String level_group_1="1";
    public static String level_group_2="2";
    public static String level_group_3="3";
    public static String level_group_4="4";
    public static String level_group_5="5";
    public static String level_group_6="6";
    public static String level_group_1_name="普通人群";
    public static String level_group_2_name="慢病人群";
    public static String level_group_3_name="65岁以上人群";
    public static String level_group_4_name="高血压";
    public static String level_group_5_name="糖尿病";
    public static String level_group_6_name="糖尿病和高血压";
    //二级维度签约扣费
    public static String level_expense_0="0";
    public static String level_expense_1="1";
    public static String level_expense_2="2";
    public static String level_expense_0_name="未扣费";
    public static String level_expense_1_name="已扣费";
    public static String level_expense_2_name="已退费";
    //二级维度健康分布
    public static String level_health_fb_0="0";
    public static String level_health_fb_1="1";
    public static String level_health_fb_2="2";
    public static String level_health_fb_3="3";
    public static String level_health_fb_4="4";
    public static String level_health_fb_0_name="未标注";
    public static String level_health_fb_1_name="健康人群";
    public static String level_health_fb_2_name="患病人群";
    public static String level_health_fb_3_name="高危人群";
    public static String level_health_fb_4_name="恢复期人群";
    //三级维度的疾病
    public static String level_disease_1="1";
    public static String level_disease_2="2";
    public static String level_disease_3="3";
    public static String level_disease_4="4";
    public static String level_disease_1_name="高血压";
    public static String level_disease_2_name="糖尿病";
    public static String level_disease_3_name="糖尿病和高血压";
    public static String level_disease_4_name="健康人群";
    public static String getlevelHealthFbName(String key){
        switch (key){
            case "1":{
                return level_health_fb_1_name;
            }
            case "2":{
                return level_health_fb_2_name;
            }
            case "3":{
                return level_health_fb_3_name;
            }
            case "4":{
                return level_health_fb_4_name;
            }
            case "0":{
                return level_health_fb_0_name;
            }
        }
        return "";
    }
    public static String getLevelExpenseName(String key){
        switch (key){
            case "1":{
                return level_expense_1_name;
            }
            case "2":{
                return level_expense_2_name;
            }
            case "0":{
                return level_expense_0_name;
            }
        }
        return "";
    }
    public static String getLevelSexName(String key){
        switch (key){
            case "1":{
                return level_sex_1_name;
            }
            case "2":{
                return level_sex_2_name;
            }
            case "3":{
                return level_sex_3_name;
            }
        }
        return "";
    }
    public static String getLevelGroupName(String key){
        switch (key){
            case "1":{
                return level_group_1_name;
            }
            case "2":{
                return level_group_2_name;
            }
            case "3":{
                return level_group_3_name;
            }
            case "4":{
                return level_group_4_name;
            }
            case "5":{
                return level_group_5_name;
            }
            case "6":{
                return level_group_6_name;
            }
        }
        return "";
    }
    public static String getLevelAgeName(String key){
        switch (key){
            case "1":{
                return level_age_1_name;
            }
            case "2":{
                return level_age_2_name;
            }
            case "3":{
                return level_age_3_name;
            }
            case "4":{
                return level_age_4_name;
            }
            case "5":{
                return level_age_5_name;
            }
            case "6":{
                return level_age_6_name;
            }
        }
        return "";
    }
    public static String getLevelDiseaseName(String key){
        switch (key){
            case "1":{
                return level_disease_1_name;
            }
            case "2":{
                return level_disease_2_name;
            }
            case "3":{
                return level_disease_3_name;
            }
            case "4":{
                return level_disease_4_name;
            }
        }
        return "";
    }
}

+ 176 - 0
patient-co-figure/src/main/java/com/yihu/figure/util/ETLConstantData.java

@ -0,0 +1,176 @@
package com.yihu.figure.util;
/**
 * Created by lyr-pc on 2017/2/20.
 */
public class ETLConstantData {
    /***************************体征指标正常范围*******************************/
    // 血糖餐前最小值
    public static final double HEALTH_STANDARD_ST_MIN_BEFORE = 4;
    // 血糖餐前最大值
    public static final double HEALTH_STANDARD_ST_MAX_BEFORE = 7;
    // 血糖餐后最小值
    public static final double HEALTH_STANDARD_ST_MIN_AFTER = 4;
    // 血糖餐后最大值
    public static final double HEALTH_STANDARD_ST_MAX_AFTER = 11.1;
    // 舒张压最小值
    public static final int HEALTH_STANDARD_SZY_MIN = 60;
    // 舒张压最大值
    public static final int HEALTH_STANDARD_SZY_MAX = 90;
    // 收缩压最小值
    public static final int HEALTH_STANDARD_SSY_MIN = 90;
    // 收缩压最大值
    public static final int HEALTH_STANDARD_SSY_MAX = 140;
    /**
     * 性别
     *
     * @return
     */
    public static String sexName(int sex) {
        switch (sex) {
            case 1:
                return "男";
            case 2:
                return "女";
            default:
                return "其他";
        }
    }
    /**
     * 年龄段
     *
     * @param age
     * @return
     */
    public static String ageInterval(int age) {
        if (age < 7) {
            return "儿童";
        } else if (age >= 7 && age <= 14) {
            return "少年";
        } else if (age >= 15 && age <= 35) {
            return "青年";
        } else if (age >= 36 && age <= 60) {
            return "中年";
        } else {
            return "老年";
        }
    }
    /**
     * 获取城市名称
     *
     * @param city
     * @return
     */
    public static String cityName(String city) {
        return "";
    }
    /**
     * 体质指数转换
     *
     * @param bmi
     * @return
     */
    public static String bmiName(double bmi) {
        if (bmi < 18.5) {
            return "偏瘦";
        } else if (bmi >= 18.5 && bmi < 24) {
            return "体重正常";
        } else if (bmi >= 24 && bmi < 27) {
            return "超重";
        } else if (bmi >= 27 && bmi < 30) {
            return "偏胖";
        } else if (bmi >= 30 && bmi < 35) {
            return "肥胖";
        } else if (bmi >= 35 && bmi < 40) {
            return "重度肥胖";
        } else {
            return "极重度肥胖";
        }
    }
    /**
     * 心律情况
     *
     * @param rate
     * @return
     */
    public static int heartRate(double rate) {
        if (rate >= 40 && rate <= 160) {
            return 0;//"心率正常";
        } else {
            return 1;//"心率不正常";
        }
    }
    /**
     * 空腹血糖判断
     *
     * @param value
     * @return
     */
    public static int xueTangBefore(double value) {
        if (value < ETLConstantData.HEALTH_STANDARD_ST_MIN_BEFORE) {
            return -1;
        }
        if (value > ETLConstantData.HEALTH_STANDARD_ST_MAX_BEFORE) {
            return 1;
        }
        return 0;
    }
    /**
     * 餐后血糖判断
     *
     * @param value
     * @return
     */
    public static int xueTangAfter(double value) {
        if (value < ETLConstantData.HEALTH_STANDARD_ST_MIN_AFTER) {
            return -1;
        }
        if (value > ETLConstantData.HEALTH_STANDARD_ST_MAX_AFTER) {
            return 1;
        }
        return 0;
    }
    /**
     * 收缩压比较
     *
     * @param value
     * @return
     */
    public static int ssy(double value) {
        if (value < ETLConstantData.HEALTH_STANDARD_SSY_MIN) {
            return -1;
        }
        if (value > ETLConstantData.HEALTH_STANDARD_SSY_MAX) {
            return 1;
        }
        return 0;
    }
    /**
     * 舒张压比较
     *
     * @param value
     * @returnz
     */
    public static int szy(double value) {
        if (value < ETLConstantData.HEALTH_STANDARD_SZY_MIN) {
            return -1;
        }
        if (value > ETLConstantData.HEALTH_STANDARD_SZY_MAX) {
            return 1;
        }
        return 0;
    }
}

+ 192 - 0
patient-co-figure/src/main/java/com/yihu/figure/util/IdCardUtil.java

@ -0,0 +1,192 @@
package com.yihu.figure.util;
import org.apache.commons.lang3.StringUtils;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
 * Created by Administrator on 2016.08.17.
 * 身份证工具类
 */
public class IdCardUtil {
//    /**
//     * 根据身份证的号码算出当前身份证持有者的年龄
//     *
//     * @param
//     * @throws Exception
//     */
//    public static int getAgeForIdcard(String card)
//            throws Exception {
//        int age = 0;
//        if (card.length() == 18) {
//            String year = card.substring(6).substring(0, 4);// 得到年份
//            String yue = card.substring(10).substring(0, 2);// 得到月份
//            // String day=CardCode.substring(12).substring(0,2);//得到日
//            Date date = new Date();// 得到当前的系统时间
//            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//            String fyear = format.format(date).substring(0, 4);// 当前年份
//            String fyue = format.format(date).substring(5, 7);// 月份
//            if (Integer.parseInt(yue) <= Integer.parseInt(fyue)) { // 当前月份大于用户出身的月份表示已过生
//                age = Integer.parseInt(fyear) - Integer.parseInt(year) + 1;
//            } else {// 当前用户还没过生
//                age = Integer.parseInt(fyear) - Integer.parseInt(year);
//            }
//        } else if (card.length() == 15) {
//            String uyear = "19" + card.substring(6, 8);// 年份
//            String uyue = card.substring(8, 10);// 月份
//            Date date = new Date();// 得到当前的系统时间
//            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
//            String fyear = format.format(date).substring(0, 4);// 当前年份
//            String fyue = format.format(date).substring(5, 7);// 月份
//            // String fday=format.format(date).substring(8,10);
//            if (Integer.parseInt(uyue) <= Integer.parseInt(fyue)) { // 当前月份大于用户出身的月份表示已过生
//                age = Integer.parseInt(fyear) - Integer.parseInt(uyear) + 1;
//            } else {// 当前用户还没过生
//                age = Integer.parseInt(fyear) - Integer.parseInt(uyear);
//            }
//
//        }
//        return age;
//    }
    /**
     * 根据身份证的号码算出当前身份证持有者的年龄
     *
     * @param
     * @throws Exception
     */
    public static int getAgeForIdcard(String idcard) {
        try {
            int age = 0;
            if (StringUtils.isEmpty(idcard)) {
                return age;
            }
            String birth = "";
            if (idcard.length() == 18) {
                birth = idcard.substring(6, 14);
            } else if (idcard.length() == 15) {
                birth = "19" + idcard.substring(6, 12);
            }
            int year = Integer.valueOf(birth.substring(0, 4));
            int month = Integer.valueOf(birth.substring(4, 6));
            int day = Integer.valueOf(birth.substring(6));
            Calendar cal = Calendar.getInstance();
            age = cal.get(Calendar.YEAR) - year;
            //周岁计算
            if (cal.get(Calendar.MONTH) < (month - 1) || (cal.get(Calendar.MONTH) == (month - 1) && cal.get(Calendar.DATE) < day)) {
                age--;
            }
            return age;
        } catch (Exception e) {
        }
        return -1;
    }
    /**
     * 身份证提取出身日期
     *
     * @param card
     * @return
     * @throws Exception
     */
    public static Date getBirthdayForIdcard(String card)
            throws Exception {
        Date b = null;
        if (card.length() == 18) {
            String year = card.substring(6).substring(0, 4);// 得到年份
            String yue = card.substring(10).substring(0, 2);// 得到月份
            String ri = card.substring(12).substring(0, 2);// 得到日
            // String day=CardCode.substring(12).substring(0,2);//得到日
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            b = format.parse(year + "-" + yue + "-" + ri);
        } else if (card.length() == 15) {
            String uyear = "19" + card.substring(6, 8);// 年份
            String uyue = card.substring(8, 10);// 月份
            String uri = card.substring(10, 12);// 得到日
            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
            b = format.parse(uyear + "-" + uyue + "-" + uri);
        }
        return b;
    }
    /**
     * 根据身份证的号码算出当前身份证持有者的性别
     * 1 女 2 男 3未知
     *
     * @return
     * @throws Exception
     */
    public static String getSexForIdcard(String CardCode)
            throws Exception {
        String sex = Constant.level_sex_3;
        if (CardCode.length() == 18) {
            if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
                // modifid by lyr 2016-09-29
                // sex =  Constant.level_sex_2;
                sex = Constant.level_sex_1;
                // modifid by lyr 2016-09-29
            } else {
                // modifid by lyr 2016-09-29
                // sex =  Constant.level_sex_1;
                sex = Constant.level_sex_2;
                // modifid by lyr 2016-09-29
            }
        } else if (CardCode.length() == 15) {
            String usex = CardCode.substring(14, 15);// 用户的性别
            if (Integer.parseInt(usex) % 2 == 0) {
                // sex =  Constant.level_sex_2;
                sex = Constant.level_sex_1;
            } else {
                // sex =  Constant.level_sex_1;
                sex = Constant.level_sex_2;
            }
        }
        return sex;
    }
    /**
     * 根据身份证的号码算出当前身份证持有者的性别
     * 1 男 2 女 3未知
     *
     * @return
     * @throws Exception
     */
    public static String getSexForIdcard_new(String CardCode)
            throws Exception {
        String sex = Constant.level_sex_3;
        try {
            if (CardCode.length() == 18) {
                if (Integer.parseInt(CardCode.substring(16).substring(0, 1)) % 2 == 0) {// 判断性别
                    // modifid by lyr 2016-09-29
                    sex = Constant.level_sex_2;
                    // modifid by lyr 2016-09-29
                } else {
                    // modifid by lyr 2016-09-29
                    sex = Constant.level_sex_1;
                    // modifid by lyr 2016-09-29
                }
            } else if (CardCode.length() == 15) {
                String usex = CardCode.substring(14, 15);// 用户的性别
                if (Integer.parseInt(usex) % 2 == 0) {
                    sex = Constant.level_sex_2;
                } else {
                    sex = Constant.level_sex_1;
                }
            }
            return sex;
        } catch (Exception e) {
            e.printStackTrace();
        }
        return sex;
    }
}

+ 511 - 0
patient-co-figure/src/main/java/com/yihu/figure/web/BaseController.java

@ -0,0 +1,511 @@
package com.yihu.figure.web;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.figure.model.IdEntity;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONArray;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.util.ReflectionUtils;
import javax.servlet.http.HttpServletRequest;
import java.lang.reflect.Field;
import java.util.*;
public class BaseController {
    private static Logger logger = LoggerFactory.getLogger(BaseController.class);
    @Autowired
    protected HttpServletRequest request;
    /**
     * 獲取髮送請求用戶的uid
     *
     * @return
     */
    public String getUID() {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getString("uid");
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 獲取髮送請求用戶的uid
     *
     * @return
     */
    public String getLastUid() {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getString("lastUid");
        } catch (Exception e) {
            return null;
        }
    }
    public String getOpenid() {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getString("openid");
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 获取用户ID
     *
     * @return
     */
    public long getId() {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getLong("id");
        } catch (Exception e) {
            return 0;
        }
    }
    public String getIMEI() {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getString("imei");
        } catch (Exception e) {
            return null;
        }
    }
    public String getToken() {
        try {
            String userAgent = request.getHeader("userAgent");
            if (StringUtils.isEmpty(userAgent)) {
                userAgent = request.getHeader("User-Agent");
            }
            JSONObject json = new JSONObject(userAgent);
            return json.getString("token");
        } catch (Exception e) {
            return null;
        }
    }
    public void error(Exception e) {
        logger.error(getClass().getName() + ":", e.getMessage());
        e.printStackTrace();
    }
    public void warn(Exception e) {
        logger.warn(getClass().getName() + ":", e.getMessage());
        e.printStackTrace();
    }
    public void infoMessage(String message) {
        logger.info(message);
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String error(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return null;
        }
    }
    /**
     * 接口处理成功
     *
     * @param msg
     * @return
     */
    public String success(String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", 200);
            map.put("msg", msg);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return null;
        }
    }
    public String write(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return null;
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param key 结果数据
     * @return
     */
    public String write(int code, String msg, String key, List<?> list) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, list);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, JSONObject value) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            json.put(key, value);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, JSONArray value) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            json.put(key, value);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param total 总数
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, int total, String key, JSONArray value) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            json.put("total", total);
            json.put(key, value);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, Object value) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, value);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param key 结果数据
     * @return
     */
    public String write(int code, String msg, String key, Page<?> list) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            // 是否为第一页
            map.put("isFirst", list.isFirst());
            // 是否为最后一页
            map.put("isLast", list.isLast());
            // 总条数
            map.put("total", list.getTotalElements());
            // 总页数
            map.put("totalPages", list.getTotalPages());
            map.put(key, list.getContent());
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param key 结果数据
     * @return
     */
    public String write(int code, String msg, String key, Page<?> page, JSONArray array) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            // 是否为第一页
            json.put("isFirst", page == null ? false : page.isFirst());
            // 是否为最后一页
            json.put("isLast", page == null ? true : page.isLast());
            // 总条数
            json.put("total", page == null ? 0 : page.getTotalElements());
            // 总页数
            json.put("totalPages", page == null ? 0 : page.getTotalPages());
            json.put(key, array);
            return json.toString();
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, Map<?, ?> value) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, value);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param value 结果数据
     * @return
     */
    public String write(int code, String msg, String key, String value) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, value);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param key 结果数据
     * @return
     */
    public String write(int code, String msg, String key, IdEntity entity) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            map.put(key, entity);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            error(e);
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @param key 结果数据
     * @return
     */
    public String write(int code, String msg, boolean isFirst, boolean isLast, long total, int totalPages, String key, Object values) {
        try {
            JSONObject json = new JSONObject();
            json.put("status", code);
            json.put("msg", msg);
            // 是否为第一页
            json.put("isFirst", isFirst);
            // 是否为最后一页
            json.put("isLast", isLast);
            // 总条数
            json.put("total", total);
            // 总页数
            json.put("totalPages", totalPages);
            json.put(key, values);
            return json.toString();
        } catch (Exception e) {
            logger.error("BaseController:", e.getMessage());
            return error(-1, "服务器异常,请稍候再试!");
        }
    }
    public String trimEnd(String param, String trimChars) {
        if (param.endsWith(trimChars)) {
            param = param.substring(0, param.length() - trimChars.length());
        }
        return param;
    }
    /**
     * 无效用户消息返回
     *
     * @param e
     * @param defaultCode
     * @param defaultMsg
     * @return
     */
    public String invalidUserException(Exception e, int defaultCode, String defaultMsg) {
        try {
            // if (e instanceof UndeclaredThrowableException) {
            // UndeclaredThrowableException ute = (UndeclaredThrowableException) e;
            // InvalidUserException iue = (InvalidUserException) ute.getUndeclaredThrowable();
            // if (iue != null) {
            // return error(iue.getCode(), iue.getMsg());
            // }
            // }
            return error(defaultCode, defaultMsg);
        } catch (Exception e2) {
            return null;
        }
    }
    public List<Map<String, Object>> copyBeans(Collection<? extends Object> beans, String... propertyNames) {
        List<Map<String, Object>> result = new ArrayList<>();
        for (Object bean : beans) {
            result.add(copyBeanProperties(bean, propertyNames));
        }
        return result;
    }
    /**
     * 复制特定属性。
     *
     * @param bean
     * @param propertyNames
     * @return
     */
    public Map<String, Object> copyBeanProperties(Object bean, String... propertyNames) {
        Map<String, Object> simplifiedBean = new HashMap<>();
        for (String propertyName : propertyNames) {
            Field field = ReflectionUtils.findField(bean.getClass(), propertyName);
            if (field != null) {
                field.setAccessible(true);
                Object value = ReflectionUtils.getField(field, bean);
                simplifiedBean.put(propertyName, value == null ? "" : value);
            } else {
                simplifiedBean.put(propertyName, "");
            }
        }
        return simplifiedBean;
    }
}

File diff suppressed because it is too large
+ 74 - 0
patient-co-figure/src/main/java/com/yihu/figure/web/HealthIndexController.java


+ 1 - 1
patient-co-wlyy/src/main/java/com/yihu/wlyy/repository/patient/PatientReservationDao.java

@ -35,6 +35,6 @@ public interface PatientReservationDao extends PagingAndSortingRepository<Patien
	PatientReservation findByPatientAndCancelerAndCancelTime(String patient,String canceler,String cancelerTime);
	//根据患者医获取近三个月的已取消的预约记录
	@Query("select a from PatientReservation a where a.patient = ?1 and (a.startTime between ?2 and ?3 or a.startTime between ?4 and ?5 ) and a.status = 0 order by a.czrq desc")
	@Query("select a from PatientReservation a where a.patient = ?1 and (a.startTime between ?2 and ?3 or a.startTime between ?4 and ?5 ) and a.status = 0 order by a.startTime desc")
	List<PatientReservation> findByPatientAndStartTime(String patientCode, String strStart, String strEnd,String startTime,String endTime);
}

+ 5 - 13
patient-co-wlyy/src/main/java/com/yihu/wlyy/util/HttpUtil.java

@ -1,22 +1,14 @@
package com.yihu.wlyy.util;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
/*
 * MD5 算法
 */