ソースを参照

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

huangwenjie 7 年 前
コミット
89614bbdcc

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

@ -41,10 +41,15 @@ public class DeviceHealthIndexController extends BaseController{
            @RequestParam(value = "idcard",required = false) String idcard,
            @RequestParam(value = "userName",required = false) String userName,
            @RequestParam(value = "indexType",required = false) String indexType,
            @RequestParam(value = "indexTypeMin1",required = false) Integer indexTypeMin1,
            @RequestParam(value = "indexTypeMax1",required = false) Integer indexTypeMax1,
            @RequestParam(value = "indexTypeMin2",required = false) Integer indexTypeMin2,
            @RequestParam(value = "indexTypeMax2",required = false) Integer indexTypeMax2,
            @RequestParam(value = "page",required = false) Integer page,
            @RequestParam(value = "rows",required = false) Integer pageSize){
        try{
            Page<DeviceHealthIndexVO> deviceHealthIndexes = healthIndexService.searchList(deviceSn,date, idcard, userName, indexType,page, pageSize);
            Page<DeviceHealthIndexVO> deviceHealthIndexes = healthIndexService.searchList(deviceSn,date, idcard, userName, indexType,page, pageSize,indexTypeMin1, indexTypeMax1, indexTypeMin2,indexTypeMax2);
            return write(200,"操作成功",page,pageSize,deviceHealthIndexes);
        }catch (Exception ex){
            error(ex);
@ -76,12 +81,10 @@ public class DeviceHealthIndexController extends BaseController{
     * @param idcard 居民身份证号
     * @param userName 居民姓名
     * @param indexType 体征类别
     * @param indexTypeMin 体征最小值
     * @param indexTypeMax 体征最大值
     * @param response
     * @return
     */
    @ResponseBody
//    @ResponseBody
    @RequestMapping(value="getExcelByFilter",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
    public  String exportList(
            @RequestParam(value = "deviceSn",required = false) String deviceSn,
@ -89,11 +92,13 @@ public class DeviceHealthIndexController extends BaseController{
            @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,
            @RequestParam(value = "indexTypeMin1",required = false) Double indexTypeMin1,
            @RequestParam(value = "indexTypeMax1",required = false) Double indexTypeMax1,
            @RequestParam(value = "indexTypeMin2",required = false) Double indexTypeMin2,
            @RequestParam(value = "indexTypeMax2",required = false) Double indexTypeMax2,
            HttpServletResponse response){
        try {
            List<DeviceHealthIndexVO> deviceHealthIndexes = healthIndexService.getExcelByFilter(deviceSn,date, idcard, userName, indexType,indexTypeMin,indexTypeMax);
            List<DeviceHealthIndexVO> deviceHealthIndexes = healthIndexService.getExcelByFilter(deviceSn,date, idcard, userName, indexType,indexTypeMin1,indexTypeMax1,indexTypeMin2,indexTypeMax2);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "patientHealthIndexDataList.xls"));
            OutputStream os = response.getOutputStream();

+ 7 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/device/repository/DeviceHealthIndexDao.java

@ -1,11 +1,18 @@
package com.yihu.wlyy.device.repository;
import com.yihu.wlyy.device.entity.DeviceHealthIndex;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by yww on 2016/12/5.
 */
public interface DeviceHealthIndexDao extends PagingAndSortingRepository<DeviceHealthIndex,Long>,JpaSpecificationExecutor<DeviceHealthIndex> {
    // 查询带未读数量的所有健康咨询列表
//    @Query("SELECT a FROM device.wlyy_patient_health_index a, wlyy.wlyy_patient b WHERE a.user = b.code")
//    Page<DeviceHealthIndex> findList(String deviceSn,String startTime,String endTime,String idcard,String userName,String indexType,Integer indexTypeMin1,Integer indexTypeMax1,Integer indexTypeMin2,Integer indexTypeMax2, Pageable pageRequest);
}

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

@ -15,10 +15,7 @@ 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;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.*;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
@ -38,10 +35,13 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
    JdbcTemplate jdbcTemplate;
    @Autowired
    private WlyyPatientDeviceDao wlyyPatientDeviceDao;
    @Autowired
    private DeviceHealthIndexDao deviceHealthIndexDao;
    public Page<DeviceHealthIndexVO> searchList(String deviceSn,String date,String idcard,String userName,String indexType,Integer page,Integer pageSize)throws Exception{
    public Page<DeviceHealthIndexVO> searchList(String deviceSn,String date,String idcard,String userName,String indexType,Integer page,Integer pageSize,
    Integer indexTypeMin1,Integer indexTypeMax1,Integer indexTypeMin2,Integer indexTypeMax2)throws Exception{
        if (page == null){
            page = 1;
        }
@ -80,6 +80,33 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
        if(!StringUtils.isEmpty(indexType)){
            filter.append("type="+indexType+";");
        }
        if("1".equals(indexType)||"2".equals(indexType)||"4".equals(indexType)){
            if(indexTypeMin1!=null){
                filter.append("value1>="+indexTypeMin1+";");
            }
            if(indexTypeMax1!=null){
                filter.append("value1<="+indexTypeMax1+";");
            }
            if(indexTypeMin2!=null){
                filter.append("value2>="+indexTypeMin2+";");
            }
            if(indexTypeMax2!=null){
                filter.append("value2<="+indexTypeMax2+";");
            }
        }else{
            if(indexTypeMin1!=null){
                filter.append("value3>="+indexTypeMin1+";");
            }
            if(indexTypeMax1!=null){
                filter.append("value3<="+indexTypeMax1+";");
            }
            if(indexTypeMin2!=null){
                filter.append("value4>="+indexTypeMin2+";");
            }
            if(indexTypeMax2!=null){
                filter.append("value4<="+indexTypeMax2+";");
            }
        }
        List<DeviceHealthIndex> list = (List<DeviceHealthIndex>)search("", filter.toString(), "-czrq", page, pageSize);
        long count = 0;
        String regex = "(\\w{3})(\\w+)(\\w{3})";
@ -103,7 +130,7 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
    }
    public List<DeviceHealthIndexVO> getExcelByFilter(String deviceSn,String date,String idcard,
                                                String userName,String indexType,String indexTypeMin,String indexTypeMax)throws Exception{
                                                String userName,String indexType,Double indexTypeMin1,Double indexTypeMax1,Double indexTypeMin2,Double indexTypeMax2)throws Exception{
        StringBuilder filter = new StringBuilder();
        if(!StringUtils.isEmpty(deviceSn)){

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

@ -48,11 +48,18 @@
			</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"/>
					<input type="text" id="search-min-1" placeholder="" class="f-ml10" data-attr-scan="indexTypeMin1"/>
				</div>
				<span class="dl-line">-</span>
				<div class="m-form-control">
					<input type="text" id="search-max" placeholder="" data-attr-scan="indexTypeMax"/>
					<input type="text" id="search-max-1" placeholder="" data-attr-scan="indexTypeMax1"/>
				</div>
				<div class="m-form-control f-ml15">
					<input type="text" id="search-min-2" placeholder="" class="f-ml10" data-attr-scan="indexTypeMin2"/>
				</div>
				<span class="dl-line">-</span>
				<div class="m-form-control">
					<input type="text" id="search-max-2" placeholder="" data-attr-scan="indexTypeMax2"/>
				</div>
			</div>
		</div>

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

@ -22,28 +22,6 @@
				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("系统异常,请联系管理员!");
//                    }
//
//                })
            }
			/* *************************** 模块初始化 ***************************** */
@ -59,15 +37,19 @@
				$idcard: $("#inp_idcard"),
				$userName: $("#inp_user_name"),//人员姓名
                $indexType: $("#inp_index_type"),//指标类型
                $searchMin:$("#search-min"),
                $searchMax:$("#search-max"),
                $searchMin1:$("#search-min-1"),
                $searchMax1:$("#search-max-1"),
                $searchMin2:$("#search-min-2"),
                $searchMax2:$("#search-max-2"),
				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.$searchMax1.ligerTextBox({width: 150});
                    this.$searchMin1.ligerTextBox({width: 150});
                    this.$searchMax2.ligerTextBox({width: 150});
                    this.$searchMin2.ligerTextBox({width: 150});
					this.$czrd.ligerDateEditor({
						format: "yyyy-MM-dd",
						showTime: false,
@ -90,10 +72,21 @@
                        valueField: 'typeId',
                        onSelected: function (value,name) {
                            if(value){
                                $("#search-max").attr('placeholder',name+"最大值");
                                $("#search-min").attr('placeholder',name+'最小值');
                                $("#search-max").val('');
                                $("#search-min").val('');
                                var valueNum1='value1';
                                var valueNum2='value2';
                                if(value==3){
                                    valueNum1='value3';
                                    valueNum2='value4';
                                }
                                $("#search-max-1").attr('placeholder',name+valueNum1+"最大值");
                                $("#search-min-1").attr('placeholder',name+valueNum1+'最小值');
                                $("#search-max-1").val('');
                                $("#search-min-1").val('');
                                $("#select-list").show();
                                $("#search-max-2").attr('placeholder',name+valueNum2+"最大值");
                                $("#search-min-2").attr('placeholder',name+valueNum2+'最小值');
                                $("#search-max-2").val('');
                                $("#search-min-2").val('');
                                $("#select-list").show();
                            }
                        }
@ -106,7 +99,6 @@
                        master.reloadGrid();
                    });
                    self.$btnExport.click(function () {
//                        master.toExcel();
                        var myform = $("<form></form>");
                        myform.attr('method','post')
                        myform.attr('action',ctx + '/admin/healthIndex/getExcelByFilter');
@ -129,26 +121,37 @@
                        //血糖/血压/体重/腰围
                        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());
                        //指标1最小值
                        var indexTypeMin1 = $("<input type='hidden' name='indexTypeMin1' />")
                        indexTypeMin1.attr('value',$("#search-min-1").val());
                        //指标1最大值
                        var indexTypeMax1 = $("<input type='hidden' name='indexTypeMax1' />")
                        indexTypeMax1.attr('value',$("#search-max-1").val());
                        //指标2最小值
                        var indexTypeMin2 = $("<input type='hidden' name='indexTypeMin2' />")
                        indexTypeMin2.attr('value',$("#search-min-2").val());
                        //指标2最大值
                        var indexTypeMax2 = $("<input type='hidden' name='indexTypeMax2' />")
                        indexTypeMax2.attr('value',$("#search-max-2").val());
                        myform.append(deviceSn);
                        myform.append(date);
                        myform.append(idcard);
                        myform.append(userName);
                        myform.append(indexType);
                        myform.append(indexTypeMin);
                        myform.append(indexTypeMax);
                        myform.append(indexTypeMin1);
                        myform.append(indexTypeMax1);
                        myform.append(indexTypeMin2);
                        myform.append(indexTypeMax2);
                        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('');
                            $("#search-max-1").val('');
                            $("#search-min-1").val('');
                            $("#select-list").hide();
                            $("#search-max-2").val('');
                            $("#search-min-2").val('');
                            $("#select-list").hide();
                        }
                    });
@ -241,12 +244,6 @@
                    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();