Переглянути джерело

续方咨询,随访相关接口BUG修改

huangwenjie 7 роки тому
батько
коміт
2c1abed161

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

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

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

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

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

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

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

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

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

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