浏览代码

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

huangwenjie 7 年之前
父节点
当前提交
93aea13a57

+ 24 - 10
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/controller/manager/device/DeviceHealthIndexController.java

@ -1,23 +1,24 @@
package com.yihu.wlyy.controller.manager.device;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.wlyy.controller.BaseController;
import com.yihu.wlyy.device.entity.DeviceHealthIndex;
import com.yihu.wlyy.device.entity.DeviceHealthIndexExportVO;
import com.yihu.wlyy.device.entity.DeviceHealthIndexVO;
import com.yihu.wlyy.service.manager.device.DeviceHealthIndexService;
import jxl.Workbook;
import jxl.write.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2016/12/5.
@ -38,10 +39,11 @@ public class DeviceHealthIndexController extends BaseController{
            @RequestParam(value = "date",required = false) String date,
            @RequestParam(value = "idcard",required = false) String idcard,
            @RequestParam(value = "userName",required = false) String userName,
            @RequestParam(value = "indexType",required = false) String indexType,
            @RequestParam(value = "page",required = false) Integer page,
            @RequestParam(value = "rows",required = false) Integer pageSize){
        try{
            Page<DeviceHealthIndex> deviceHealthIndexes = healthIndexService.searchList(deviceSn,date, idcard, userName, page, pageSize);
            Page<DeviceHealthIndexVO> deviceHealthIndexes = healthIndexService.searchList(deviceSn,date, idcard, userName, indexType,page, pageSize);
            return write(200,"操作成功",page,pageSize,deviceHealthIndexes);
        }catch (Exception ex){
            error(ex);
@ -50,19 +52,31 @@ public class DeviceHealthIndexController extends BaseController{
    }
    
    //导出报表
    @ResponseBody
    @RequestMapping(value="toExcel",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
    public void exportList(
            @RequestParam(value = "town",required = false)String town,
            @RequestParam(value = "hospital",required = false)String hospital,
    public  String exportList(
            @RequestParam(value = "deviceSn",required = false) String deviceSn,
            @RequestParam(value = "date",required = false) String date,
            @RequestParam(value = "idcard",required = false) String idcard,
            @RequestParam(value = "userName",required = false) String userName,
            @RequestParam(value = "indexType",required = false) String indexType,
            @RequestParam(value = "indexTypeMin",required = false) String indexTypeMin,
            @RequestParam(value = "indexTypeMax",required = false) String indexTypeMax,
            HttpServletResponse response){
        try {
            List<DeviceHealthIndexExportVO> wlyyDevices = healthIndexService.exportDeviceHealthIndexList(town,hospital);
//            List<DeviceHealthIndexExportVO> wlyyDevices = healthIndexService.exportDeviceHealthIndexList(town,hospital);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "deviceHealthIndexDataList.xls"));
            OutputStream os = response.getOutputStream();
            this.write(os,wlyyDevices);
//            this.write(os,wlyyDevices);
//            write(200, "操作成功!");
//            Map<Object, Object> map = new HashMap<Object, Object>();
//            map.put("status", 200);
//            map.put("msg", "操作成功!");
            return write(200, "操作成功");
        }catch (Exception ex){
            error(ex);
            return null;
        }
    }
    

+ 9 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/entity/DeviceHealthIndex.java

@ -25,6 +25,7 @@ public class DeviceHealthIndex {
    private int type;
    private String user;
    private String userName;
    private Integer status;
    private String value1;
    private String value2;
    private String value3;
@ -202,4 +203,12 @@ public class DeviceHealthIndex {
        this.value7 = value7;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 199 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/entity/DeviceHealthIndexVO.java

@ -0,0 +1,199 @@
package com.yihu.wlyy.device.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import javax.persistence.*;
import java.util.Date;
/**
 * Created by yww on 2016/12/5.
 * 体征数据表
 */
public class DeviceHealthIndexVO {
    private Long id;
    private Date czrq;
    private String del;
    private String deviceSn;
    private String idcard;
    private String intervene;
    private Date recordDate;
    private Date sortDate;
    private int type;
    private String user;
    private String userName;
    private Integer status;
    private String value1;
    private String value2;
    private String value3;
    private String value4;
    private String value5;
    private String value6;
    private String value7;
    private String healthStandard;
    public DeviceHealthIndexVO() {
    }
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    @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;
    }
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getIntervene() {
        return intervene;
    }
    public void setIntervene(String intervene) {
        this.intervene = intervene;
    }
    @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;
    }
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    public Date getSortDate() {
        return sortDate;
    }
    public void setSortDate(Date sortDate) {
        this.sortDate = sortDate;
    }
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    public String getUserName() {
        return userName;
    }
    public void setUserName(String userName) {
        this.userName = userName;
    }
    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;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getHealthStandard() {
        return healthStandard;
    }
    public void setHealthStandard(String healthStandard) {
        this.healthStandard = healthStandard;
    }
}

+ 23 - 2
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/entity/WlyyPatientDeviceVO.java

@ -1,5 +1,7 @@
package com.yihu.wlyy.device.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
@ -23,6 +25,8 @@ public class WlyyPatientDeviceVO {
	private String doctorName;
	private String hospital;
	private String hospitalName;
	private String doctorHealthName;
	private String doctorHealth;
	
	public Integer getId() {
		return id;
@ -103,11 +107,12 @@ public class WlyyPatientDeviceVO {
	public void setUserIdcard(String userIdcard) {
		this.userIdcard = userIdcard;
	}
	
	@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;
	}
@ -143,4 +148,20 @@ public class WlyyPatientDeviceVO {
	public void setHospitalName(String hospitalName) {
		this.hospitalName = hospitalName;
	}
	public String getDoctorHealthName() {
		return doctorHealthName;
	}
	public void setDoctorHealthName(String doctorHealthName) {
		this.doctorHealthName = doctorHealthName;
	}
	public String getDoctorHealth() {
		return doctorHealth;
	}
	public void setDoctorHealth(String doctorHealth) {
		this.doctorHealth = doctorHealth;
	}
}

+ 111 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/entity/device/PatientHealthStandard.java

@ -0,0 +1,111 @@
package com.yihu.wlyy.entity.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.wlyy.entity.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.util.Date;
/**
 * 患者健康指标预警值
 * @author George
 *
 */
@Entity
@Table(name = "wlyy_patient_health_standard")
public class PatientHealthStandard extends IdEntity {
	/**
	 *
	 */
	private static final long serialVersionUID = -8343925049051333359L;
	// 患者标识
	private String patient;
	// 健康指标类型:1血糖,2血压,3体重,4腰围
	private Integer type;
	// 最低安全值(血糖餐前\收缩压\体重\腰围)
	private Double minValue1;
	// 最高安全值(血糖餐前\收缩压\体重\腰围)
	private Double maxValue1;
	// 最低安全值(血糖餐后\舒张压)
	private Double minValue2;
	// 最高安全值(血糖餐后\舒张压)
	private Double maxValue2;
	// 设置医生
	private String doctor;
	// 设置时间
	private Date czrq;
	public String getPatient() {
		return patient;
	}
	public void setPatient(String patient) {
		this.patient = patient;
	}
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	@Column(name = "min_value_1")
	public Double getMinValue1() {
		return minValue1;
	}
	public void setMinValue1(Double minValue) {
		this.minValue1 = minValue;
	}
	@Column(name = "max_value_1")
	public Double getMaxValue1() {
		return maxValue1;
	}
	public void setMaxValue1(Double maxValue) {
		this.maxValue1 = maxValue;
	}
	@Column(name = "min_value_2")
	public Double getMinValue2() {
		return minValue2;
	}
	public void setMinValue2(Double minValue) {
		this.minValue2 = minValue;
	}
	@Column(name = "max_value_2")
	public Double getMaxValue2() {
		return maxValue2;
	}
	public void setMaxValue2(Double maxValue) {
		this.maxValue2 = maxValue;
	}
	public String getDoctor() {
		return doctor;
	}
	public void setDoctor(String doctor) {
		this.doctor = doctor;
	}
	@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;
	}
}

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

@ -1,10 +1,14 @@
package com.yihu.wlyy.repository;
import com.yihu.wlyy.entity.WlyyPatientDevice;
import com.yihu.wlyy.entity.device.PatientHealthStandard;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yww on 2016/12/7.
 */
public interface WlyyPatientDeviceDao extends PagingAndSortingRepository<WlyyPatientDevice,Integer> {
    @Query("select a from PatientHealthStandard a where a.patient = ?1 and a.type = ?2")
    PatientHealthStandard findByPatientType(String patient, int type);
}

+ 85 - 7
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/DeviceHealthIndexService.java

@ -2,12 +2,18 @@ package com.yihu.wlyy.service.manager.device;
import com.yihu.wlyy.device.entity.DeviceHealthIndex;
import com.yihu.wlyy.device.entity.DeviceHealthIndexExportVO;
import com.yihu.wlyy.device.entity.DeviceHealthIndexVO;
import com.yihu.wlyy.device.repository.DeviceHealthIndexDao;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.device.PatientHealthStandard;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.WlyyPatientDeviceDao;
import com.yihu.wlyy.util.DateTimeUtil;
import com.yihu.wlyy.util.SystemConf;
import com.yihu.wlyy.util.query.BaseDeviceJpaService;
import org.apache.commons.lang3.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
@ -30,10 +36,12 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
    private PatientDao patientDao;
    @Autowired
    JdbcTemplate jdbcTemplate;
    @Autowired
    private WlyyPatientDeviceDao wlyyPatientDeviceDao;
    public Page<DeviceHealthIndex> searchList(String deviceSn,String date,String idcard,String userName,Integer page,Integer pageSize)throws Exception{
    public Page<DeviceHealthIndexVO> searchList(String deviceSn,String date,String idcard,String userName,String indexType,Integer page,Integer pageSize)throws Exception{
        if (page == null){
            page = 1;
        }
@ -66,23 +74,32 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
            if(codes != null && codes.length >0){
                filter.append("user="+StringUtils.join(codes, ","));
            }else {
                return new PageImpl<DeviceHealthIndex>(new ArrayList<>(), pageRequest, 0);
                return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
            }
        }
        if(!StringUtils.isEmpty(indexType)){
            filter.append("type="+indexType+";");
        }
        List<DeviceHealthIndex> list = (List<DeviceHealthIndex>)search("", filter.toString(), "-czrq", page, pageSize);
        long count = 0;
        String regex = "(\\w{3})(\\w+)(\\w{3})";
        List<DeviceHealthIndexVO> listTemp = new ArrayList<>();
        if(list !=null && list.size()>0){
            count = getCount(filter.toString());
            for (DeviceHealthIndex info : list){
                Patient patient = findPatient(info.getUser());
                info.setUserName(patient== null?"":patient.getName());
                if(StringUtils.isNotBlank(info.getIdcard())){
                    info.setIdcard(info.getIdcard().replaceAll(regex, "$1****$3"));
                DeviceHealthIndexVO bean = new DeviceHealthIndexVO();
                BeanUtils.copyProperties(info, bean);
//                BeanUtils.copyProperties(bean, info);
                Patient patient = findPatient(bean.getUser());
                bean.setUserName(patient== null?"":patient.getName());
                if(StringUtils.isNotBlank(bean.getIdcard())){
                    bean.setIdcard(bean.getIdcard().replaceAll(regex, "$1****$3"));
                }
                bean.setHealthStandard(gethealthStandard(info.getType(),info.getUser()).toString());
                listTemp.add(bean);
            }
        }
        return new PageImpl<DeviceHealthIndex>(list,pageRequest,count);
        return new PageImpl<DeviceHealthIndexVO>(listTemp,pageRequest,count);
    }
    //查询居民姓名
@ -109,4 +126,65 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
        list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(DeviceHealthIndexExportVO.class));
        return list ;
	}
    public JSONObject gethealthStandard(Integer type, String patientCode) {
        //血糖校验
        JSONObject json = new JSONObject();
        if (type == 1) {
            // 血糖记录,查询患者血糖预警值
            PatientHealthStandard standard = wlyyPatientDeviceDao.findByPatientType(patientCode, 1);
            Double maxValueBefore = SystemConf.HEALTH_STANDARD_ST_MAX_BEFORE;
            Double minValueBefore = SystemConf.HEALTH_STANDARD_ST_MIN_BEFORE;
            Double maxValueAfter = SystemConf.HEALTH_STANDARD_ST_MAX_AFTER;
            Double minValueAfter = SystemConf.HEALTH_STANDARD_ST_MIN_AFTER;
            if (standard != null) {
                if (standard.getMaxValue1() > 0) {
                    maxValueBefore = standard.getMaxValue1();
                }
                if (standard.getMinValue1() > 0) {
                    minValueBefore = standard.getMinValue1();
                }
                if (standard.getMaxValue2() > 0) {
                    maxValueAfter = standard.getMaxValue2();
                }
                if (standard.getMinValue2() > 0) {
                    minValueAfter = standard.getMinValue2();
                }
            }
            json.put("maxValueAfter", maxValueAfter);
            json.put("maxValueBefore", maxValueBefore);
            json.put("minValueBefore", minValueBefore);
            json.put("minValueAfter", minValueAfter);
        }
        //血压校验
        else if (type == 2) {
            // 血压记录,查询患者血压预警值
            PatientHealthStandard standard = wlyyPatientDeviceDao.findByPatientType(patientCode, 2);
            Double maxValueSSY = SystemConf.HEALTH_STANDARD_SSY_MAX;
            Double minValueSSY = SystemConf.HEALTH_STANDARD_SSY_MIN;
            Double maxValueSZY = SystemConf.HEALTH_STANDARD_SZY_MAX;
            Double minValueSZY = SystemConf.HEALTH_STANDARD_SZY_MIN;
            if (standard != null) {
                if (standard.getMaxValue1() > 0) {
                    maxValueSSY = standard.getMaxValue1();
                }
                if (standard.getMinValue1() > 0) {
                    minValueSSY = standard.getMinValue1();
                }
                if (standard.getMaxValue2() > 0) {
                    maxValueSZY = standard.getMaxValue2();
                }
                if (standard.getMinValue2() > 0) {
                    minValueSZY = standard.getMinValue2();
                }
            }
            json.put("minValueSZY", minValueSZY);
            json.put("maxValueSZY", maxValueSZY);
            json.put("minValueSSY", minValueSSY);
            json.put("maxValueSSY", maxValueSSY);
        }
        return json;
    }
}

+ 3 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/service/manager/device/WlyyPatientDeviceService.java

@ -145,7 +145,9 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
                "s.doctor as doctor," +
                "d.czrq as czrq," +
                "s.hospital_name as hospitalName," +
                "s.hospital as hospital " +
                "s.hospital as hospital," +
                "s.doctor_health_name as doctorHealthName,"+
                "s.doctor_health as doctorHealth "+
                "FROM " +
                "wlyy_sign_family s," +
                "wlyy_patient_device d," +

+ 24 - 5
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/deviceHealthIndex_list.jsp

@ -11,11 +11,14 @@
<head>
	<%@ include file="../head/page_head.jsp" %>
	<title>设备管理</title>
	<style>
		.dl-line{float: left;padding:10px 10px 8px;line-height: 1}
	</style>
</head>
<body>
<div id="div_wrapper">
	<!-- 检索条件 -->
	<div class="m-retrieve-area f-h50 f-dn f-pr m-form-inline" data-role-form style='display: block;'>
	<div class="m-retrieve-area f-dn f-pr m-form-inline" data-role-form style='display: block;'>
		<div class="m-form-group f-mt10">
			<div class="m-form-control f-ml15">
@ -30,12 +33,28 @@
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_user_name" placeholder="请输入居民姓名" class="f-ml10" data-attr-scan="userName"/>
			</div>
			<sec:authorize url="/admin/healthIndex/list">
			<div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
				<span>查询</span>
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_index_type" placeholder="血糖/血压/体重/腰围" class="f-ml10" data-attr-scan="indexType"/>
			</div>
			<sec:authorize url="/admin/healthIndex/list">
				<div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
					<span>查询</span>
				</div>
			</sec:authorize>
			<sec:authorize url="/admin/healthIndex/toExcel">
				<div id="btn_excel" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
					<span>导出</span>
				</div>
			</sec:authorize>
			<div id="select-list" class="f-mt10" style="display: none">
				<div class="m-form-control f-ml15">
					<input type="text" id="search-min" placeholder="" class="f-ml10" data-attr-scan="indexTypeMin"/>
				</div>
				<span class="dl-line">-</span>
				<div class="m-form-control">
					<input type="text" id="search-max" placeholder="" data-attr-scan="indexTypeMax"/>
				</div>
			</div>
		</div>
	</div>
	<!-- 列表 -->

+ 144 - 5
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/deviceHealthIndex_list_js.jsp

@ -22,12 +22,35 @@
				this.grid.setOptions({parms: params});
				this.grid.loadData(true);
			}
            function reloadExcel(params) {
//                $.ajax({
//                    url: ctx + "/admin/healthIndex/toExcel",
//                    type: "post",
//                    dataType: "json",
//                    async: "true",
//                    data: params,
//                    success: function (result) {
//                        debugger;
//                        if (result.status == '200') {
//                            $.Notice.success(result.msg);
//                        } else {
//                            $.Notice.error(result.msg);
//                        }
//                    },
//                    error: function (data) {
//                        $.Notice.error("系统异常,请联系管理员!");
//                    }
//
//                })
            }
			/* *************************** 模块初始化 ***************************** */
			retrieve = {
				$element: $('.m-retrieve-area'),
				$searchBtn: $('#btn_search'),
                $btnExport: $('#btn_excel'),
				$addBtn: $('#btn_add'),
@ -35,11 +58,16 @@
				$czrd: $("#inp_czrq"),
				$idcard: $("#inp_idcard"),
				$userName: $("#inp_user_name"),//人员姓名
                $indexType: $("#inp_index_type"),//指标类型
                $searchMin:$("#search-min"),
                $searchMax:$("#search-max"),
				init: function () {
					this.$element.show();
					this.$element.attrScan();
					window.form = this.$element;
					this.$deviceCode.ligerTextBox({width: 200});
                    this.$searchMax.ligerTextBox({width: 150});
                    this.$searchMin.ligerTextBox({width: 150});
					this.$czrd.ligerDateEditor({
						format: "yyyy-MM-dd",
						showTime: false,
@ -50,13 +78,80 @@
					this.$idcard.ligerTextBox({width: 150});
					this.$userName.ligerTextBox({width: 150});
					this.bindEvents();
                    this.typeBox = this.$indexType.ligerComboBox({
                        width: 150,
                        data: [
                            {text: '血糖', typeId: '1'},
                            {text: '血压', typeId: '2'},
                            {text: '体重', typeId: '3'},
                            {text: '腰围', typeId: '4'}
                        ],
//                        initIsTriggerEvent: false,
                        valueField: 'typeId',
                        onSelected: function (value,name) {
                            if(value){
                                $("#search-max").attr('placeholder',name+"最大值");
                                $("#search-min").attr('placeholder',name+'最小值');
                                $("#search-max").val('');
                                $("#search-min").val('');
                                $("#select-list").show();
                            }
                        }
                    });
				},
				bindEvents: function () {
					var self = this;
					self.$searchBtn.click(function () {
						master.grid.options.newPage = 1;
						master.reloadGrid();
					});
                        master.grid.options.newPage = 1;
                        master.reloadGrid();
                    });
                    self.$btnExport.click(function () {
//                        master.toExcel();
                        var myform = $("<form></form>");
                        myform.attr('method','post')
                        myform.attr('action',ctx + '/admin/healthIndex/toExcel');
                        self.$element.attrScan();
                        var values = self.$element.Fields.getValues();
                        //设备SN码
                        var deviceSn = $("<input type='hidden' name='deviceSn' />")
                        deviceSn.attr('value',$("#inp_device_code").val());
                        //查询日期
                        var date = $("<input type='hidden' name='date' />")
                        date.attr('value',$("#inp_czrq").val());
                        //身份证号
                        var idcard = $("<input type='hidden' name='idcard' />")
                        idcard.attr('value',$("#inp_idcard").val());
                        //居民姓名
                        var userName = $("<input type='hidden' name='userName' />")
                        userName.attr('value',$("#inp_user_name").val());
                        //血糖/血压/体重/腰围
                        var indexType = $("<input type='hidden' name='indexType' />")
                        indexType.attr('value',$("#inp_index_type_val").val());
                        //指标最小值
                        var indexTypeMin = $("<input type='hidden' name='indexTypeMin' />")
                        indexTypeMin.attr('value',$("#search-min").val());
                        //指标最大值
                        var indexTypeMax = $("<input type='hidden' name='indexTypeMax' />")
                        indexTypeMax.attr('value',$("#search-max").val());
                        myform.append(deviceSn);
                        myform.append(date);
                        myform.append(idcard);
                        myform.append(userName);
                        myform.append(indexType);
                        myform.append(indexTypeMin);
                        myform.append(indexTypeMax);
                        myform.appendTo('body').submit(); //must add this line for higher html spec
                    });
					//隐藏操作
                    self.$indexType.change(function(obj){
                        if(!obj.target.value){
                            $("#search-max").val('');
                            $("#search-min").val('');
                            $("#select-list").hide();
                        }
                    });
				}
			};
			master = {
@ -91,8 +186,45 @@
									}
								}
							},
							{display: 'value1', name: 'value1', width: '5%', align: "center"},
							{display: 'value2', name: 'value2', width: '5%', align: "center"},
							{display: 'value1', name: 'value1', width: '5%', align: "center",
                                render: function (row) {
                                    var standard = typeof(row.healthStandard)=='object'?row.healthStandard:JSON.parse(row.healthStandard)
                                    if(row.type==1){
                                        if(row.value1>standard.minValueBefore&&row.value1<standard.maxValueBefore){
                                            return row.value1;
                                        }else {
                                            return "<span style='color:red;'>"+row.value1+"</span>";
                                        }
                                    }else if(row.type==2){
                                        if(row.value1>standard.minValueSSY&&row.value1<standard.maxValueSSY){
                                            return row.value1;
                                        }else {
                                            return "<span style='color:red;'>"+row.value1+"</span>";
                                        }
                                    }
                                }
                            },
							{display: 'value2', name: 'value2', width: '5%', align: "center",
                                render: function (row) {
                                    var standard = typeof(row.healthStandard)=='object'?row.healthStandard:JSON.parse(row.healthStandard)
                                    if(row.type==1){
                                        if(row.value2>standard.minValueAfter&&row.value2<standard.maxValueAfter){
                                            return row.value2;
                                        }else {
                                            return "<span style='color:red;'>"+row.value2+"</span>";
                                        }
                                    }else if(row.type==2){
                                        if(row.value2>standard.minValueSZY&&row.value2<standard.maxValueSZY){
                                            return row.value2;
                                        }else {
                                            return "<span style='color:red;'>"+row.value2+"</span>";
                                        }
                                    }
                                }
                            },
							{display: 'value3', name: 'value3', width: '5%', align: "center"},
							{display: 'value4', name: 'value4', width: '5%', align: "center"},
							{display: 'value5', name: 'value5', width: '5%', align: "center"},
@ -106,8 +238,15 @@
				reloadGrid: function (msg) {
					retrieve.$element.attrScan();
					var values = retrieve.$element.Fields.getValues();
                    values.indexType = retrieve.typeBox.getValue();
					reloadGrid.call(this, values);
				},
                toExcel: function (msg) {
                    retrieve.$element.attrScan();
                    var values = retrieve.$element.Fields.getValues();
                    values.indexType = retrieve.typeBox.getValue();
                    reloadExcel(values);
                }
			};
			pageInit();

+ 2 - 1
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/device/patientDevice_list_js.jsp

@ -94,9 +94,10 @@
							{display: 'SIM码', name: 'sim', width: '5%', align: "left"},
                            {display: '社区', name: 'hospitalName', width: '10%', align: "left"},
                            {display: '医生', name: 'doctorName', width: '5%', align: "left"},
                            {display: '健管师', name: 'doctorHealthName', width: '5%', align: "left"},
							{display: '居民姓名', name: 'userName', width: '5%', align: "center"},
							{
								display: '绑定按键', name: 'userType', width: '10%', align: "center",
								display: '绑定按键', name: 'userType', width: '5%', align: "center",
								render: function (row) {
									if (row.userType == "-1") {
										return ""