瀏覽代碼

居民健康管理平台新增设备体征数据导出

humingfen 7 年之前
父節點
當前提交
2f632652bb

+ 1 - 1
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/config/SpringSecurityConfig.java

@ -40,7 +40,7 @@ public class SpringSecurityConfig extends WebSecurityConfigurerAdapter {
                "/admin/device/toExcel",
                "/admin/device/importData",
                "/admin/patientDevice/toExcel",
                "/admin/healthIndex/toExcel",
                "/admin/healthIndex/**",
                "/admin/healthIndex/getExcelByFilter",
                "/admin/static/prescription/toExcel",
                "/admin/static/wechat/listToExcel",

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

@ -74,6 +74,23 @@ public class DeviceHealthIndexController extends BaseController{
        }
    }
    //设备体征报表导出
    @RequestMapping(value="export",method = RequestMethod.POST,produces = "application/json;charset=UTF-8" )
    public void export(
            @RequestParam(value = "town",required = false)String town,
            @RequestParam(value = "hospital",required = false)String hospital,
            HttpServletResponse response){
        try {
            List<DeviceHealthIndexExportVO> wlyyDevices = healthIndexService.exportDeviceHealthList(town,hospital);
            response.setContentType("octets/stream");
            response.setHeader("Content-Disposition", "attachment; filename="+ new String( "deviceHealthIndexDataList.xls"));
            OutputStream os = response.getOutputStream();
            this.write(os,wlyyDevices);
        }catch (Exception ex){
            error(ex);
        }
    }
    /**
     * 按筛选条件导出居民体征数据报表
     * @param deviceSn 设备sn码

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

@ -477,6 +477,35 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
        return list ;
	}
    /**
     * 导出设备体征上传明细(包含绑定未使用)
     * @param town
     * @param hospital
     * @return
     */
    public List<DeviceHealthIndexExportVO> exportDeviceHealthList(String town, String hospital) {
        List<DeviceHealthIndexExportVO> list = new ArrayList<>();
        String sql  = "SELECT " +
                "s.patient," +
                "s.`name`," +
                "case when s.mobile !='' then  CONCAT(left(s.mobile,3),'*******',right(s.mobile,2)) else  s.mobile end mobile," +
                "CONCAT(left(s.idcard,6),'**********',right(s.idcard,2)) idcard," +
                "pd.device_sn," +
                "pd.device_name," +
                "d.record_date," +
                "d.amount,"+
//                "CASE d.type WHEN 1 THEN '血糖' WHEN 2 THEN '血压' WHEN 3 THEN '体重' WHEN 4 THEN '腰围' END statusName,"+
                "s.doctor_name," +
                "p.address FROM wlyy_sign_family s,wlyy_patient p,wlyy_patient_device pd LEFT JOIN(" +
                "SELECT i.`user`,i.device_sn, i.type, max(i.record_date) record_date, count(i.id) amount, w.device_name " +
                "FROM device.wlyy_patient_health_index i,wlyy_patient_device w "+
                "WHERE i.device_sn = w.device_sn AND i.del=1 AND i.`type` IN (1, 2) GROUP BY i.`user`,i.device_sn,i.type) d on pd.user = d.`user`"+
                "WHERE s.patient = pd.`user` AND s.hospital='"+hospital+"' AND s.`status`> 0 AND s.patient=p.code  ORDER BY d.record_date desc ";
        list =  jdbcTemplate.query(sql,new BeanPropertyRowMapper(DeviceHealthIndexExportVO.class));
        return list ;
    }
    public JSONObject gethealthStandard(Integer type, String patientCode) {
        //血糖校验
        JSONObject json = new JSONObject();

+ 4 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/static_device.jsp

@ -33,6 +33,10 @@
                <span>体征上传明细</span>
                <br>
            </div>
            <div id="export_device_healthindex_list" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >
                <span>体征设备明细</span>
                <br>
            </div>
            <br>
        </div>
    </div>

+ 27 - 0
patient-co-manage/wlyy-manage/src/main/webapp/WEB-INF/views/static/static_device_js.jsp

@ -39,6 +39,7 @@
                $btnDeviceList: $('#export_patient_device_list'),
                $btnHealthindexList: $('#export_patient_healthindex_list'),
                $btnDeviceHealthList: $('#export_device_healthindex_list'),
                init: function () {
                    this.initComboBox();
                    this.bindEvents();
@ -181,6 +182,32 @@
                        attention.attr('value',$("#inp_att_val").val());
                        myform.append(town);
                        myform.append(hospital);
                        myform.append(attention);
                        myform.appendTo('body').submit(); //must add this line for higher html spec
                    });
                    //居民体征设备详情(包含绑定没有使用过)导出
                    me.$btnDeviceHealthList.on('click',function () {
                        //定义一个form表单
                        var myform = $("<form></form>");
                        myform.attr('method','post')
                        myform.attr('action',ctx + '/admin/healthIndex/export');
                        //区
                        var town = $("<input type='hidden' name='town' />")
                        town.attr('value',$("#inp_categoryCode").val());
                        //社区医院
                        var hospital = $("<input type='hidden' name='hospital' />")
                        hospital.attr('value',$("#inp_hos_val").val());
                        //关注状态
                        var attention = $("<input type='hidden' name='attention' />")
                        attention.attr('value',$("#inp_att_val").val());
                        myform.append(town);
                        myform.append(hospital);
                        myform.append(attention);