Bladeren bron

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

huangwenjie 7 jaren geleden
bovenliggende
commit
4c43a8952b

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

@ -65,33 +65,34 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
        User loginUser = (User) request.getSession().getAttribute("userInfo");
        Pageable pageRequest = new PageRequest(page-1,pageSize);
        StringBuilder filter = new StringBuilder();
        String sql = "SELECT a.patient  FROM wlyy.wlyy_sign_family a, wlyy.wlyy_patient b WHERE a.status > 0 AND a.patient = b.code  ";
        String sql =" SELECT i.* ,s.name userName FROM device.wlyy_patient_health_index i , wlyy.wlyy_sign_family s WHERE s. STATUS > 0  and i.user=s.patient ";
        String countSql =" SELECT count(1) as num FROM device.wlyy_patient_health_index i, wlyy.wlyy_sign_family s WHERE s. STATUS > 0  and i.user=s.patient ";
        //1、管理员  2、医生 0、其他
        if(loginUser.getType()==2){
            Doctor doctor = doctorDao.findByCode(loginUser.getCode());
            if(doctor!=null &&StringUtils.isNotEmpty(doctor.getHospital())){
                sql += " AND a.hospital = '"+doctor.getHospital()+"' ";
                filter.append(" AND s.hospital = '"+doctor.getHospital()+"' ");
            }
        }
        //根据患者名称过滤
        if(!StringUtils.isEmpty(userName)){
            sql +=" AND b.NAME LIKE '%"+userName+"%'";
            filter.append(" AND s.NAME LIKE '%"+userName+"%' ");
        }
        //根据健管师或医生名称过滤
        if(!StringUtils.isEmpty(doctorName)){
            sql += " and (a.doctor_name like '%"+doctorName+"%' or a.doctor_health_name like '%"+doctorName+"%') ";
            filter.append(" and (s.doctor_name like '%"+doctorName+"%' or s.doctor_health_name like '%"+doctorName+"%') ");
        }
        List<String> patientList = jdbcTemplate.queryForList(sql,String.class);
        if(!StringUtils.isEmpty(deviceSn)){
            filter.append("deviceSn="+deviceSn+";");
            filter.append(" and i.deviceSn="+deviceSn);
        }
        if(!StringUtils.isEmpty(idcard)){
            filter.append("idcard="+idcard+";");
            filter.append(" and i.idcard="+idcard);
        }
        //体征数据创建时间
        if(!StringUtils.isEmpty(date)){
            Date startTimeTemp  =  DateTimeUtil.simpleDateParse(date);
            Calendar calendar = new GregorianCalendar();
@ -101,63 +102,81 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
            calendar.set(Calendar.SECOND,59);
            calendar.set(Calendar.MILLISECOND,999);
            Date endTimeTemp = calendar.getTime();
            filter.append("czrq>=" + DateTimeUtil.utcDateTimeFormat(startTimeTemp)+ ";");
            filter.append("czrq<=" + DateTimeUtil.utcDateTimeFormat(endTimeTemp)+ ";");
            filter.append(" and i.czrq>=" + DateTimeUtil.utcDateTimeFormat(startTimeTemp));
            filter.append(" and i.czrq<=" + DateTimeUtil.utcDateTimeFormat(endTimeTemp));
        }
        if(patientList != null && patientList.size() >0){
            String temp = StringUtils.join(patientList, ",");
//            temp = temp.substring(0,temp.length()-1);
            filter.append("user="+temp+";");
        }else {
            return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
        }
        //指标类型
        if(!StringUtils.isEmpty(indexType)){
            filter.append("type="+indexType+";");
            filter.append(" and i.type="+indexType);
        }
        //体征数据
        if("1".equals(indexType)||"2".equals(indexType)||"4".equals(indexType)){
            if(indexTypeMin1!=null){
                filter.append("value1>="+indexTypeMin1+";");
                filter.append(" and value1>="+indexTypeMin1);
            }
            if(indexTypeMax1!=null){
                filter.append("value1<="+indexTypeMax1+";");
                filter.append(" and value1<="+indexTypeMax1);
            }
            if(indexTypeMin2!=null){
                filter.append("value2>="+indexTypeMin2+";");
                filter.append(" and value2>="+indexTypeMin2);
            }
            if(indexTypeMax2!=null){
                filter.append("value2<="+indexTypeMax2+";");
                filter.append(" and value2<="+indexTypeMax2);
            }
        }else{
            if(indexTypeMin1!=null){
                filter.append("value3>="+indexTypeMin1+";");
                filter.append(" and value3>="+indexTypeMin1);
            }
            if(indexTypeMax1!=null){
                filter.append("value3<="+indexTypeMax1+";");
                filter.append(" and value3<="+indexTypeMax1);
            }
            if(indexTypeMin2!=null){
                filter.append("value4>="+indexTypeMin2+";");
                filter.append(" and value4>="+indexTypeMin2);
            }
            if(indexTypeMax2!=null){
                filter.append("value4<="+indexTypeMax2+";");
                filter.append(" and value4<="+indexTypeMax2);
            }
        }
        List<DeviceHealthIndex> list = (List<DeviceHealthIndex>)search("", filter.toString(), "-czrq", page, pageSize);
        String f = filter.toString();
        List<Map<String, Object>> resultList = jdbcTemplate.queryForList(sql+f+" order by i.czrq desc "+" limit "+(page-1)+","+pageSize);
        if(resultList.size()<=0){
            return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
        }
        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){
        if(resultList !=null && resultList.size()>0){
//            count = getCount(filter.toString());
            count = jdbcTemplate.queryForObject(countSql+filter.toString(),Long.class);
            for (Map<String, Object> info : resultList){
                DeviceHealthIndexVO bean = new DeviceHealthIndexVO();
                BeanUtils.copyProperties(info, bean);
//                BeanUtils.copyProperties(bean, info);
                Patient patient = findPatient(bean.getUser());
                bean.setUserName(patient== null?"":patient.getName());
                bean.setId(Long.getLong(info.get("id")+""));
                bean.setCzrq(info.get("czrq")!=null?(Date)info.get("czrq"):null);
                bean.setDel(info.get("del")!=null?info.get("del")+"":null);
                bean.setDeviceSn(info.get("device_sn")!=null?info.get("device_sn")+"":null);
                bean.setIdcard(info.get("idcard")!=null?info.get("idcard")+"":null);
                bean.setIntervene(info.get("intervene")!=null?info.get("intervene")+"":null);
                bean.setRecordDate(info.get("record_date")!=null?(Date)info.get("record_date"):null);
                bean.setSortDate(info.get("sort_date")!=null?(Date)info.get("sort_date"):null);
                bean.setStatus(info.get("status")!=null?(Integer)info.get("status"):null);
                bean.setType(info.get("type")!=null?(Integer)info.get("type"):0);
                bean.setUser(info.get("user")!=null?info.get("user")+"":null);
                bean.setUserName(info.get("userName")!=null?info.get("userName")+"":null);
                bean.setValue1(info.get("value1")!=null?info.get("value1")+"":null);
                bean.setValue2(info.get("value2")!=null?info.get("value2")+"":null);
                bean.setValue3(info.get("value3")!=null?info.get("value3")+"":null);
                bean.setValue4(info.get("value4")!=null?info.get("value4")+"":null);
                bean.setValue5(info.get("value5")!=null?info.get("value5")+"":null);
                bean.setValue6(info.get("value6")!=null?info.get("value6")+"":null);
                bean.setValue7(info.get("value7")!=null?info.get("value7")+"":null);
//                BeanUtils.copyProperties(info, bean);
//                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());
                bean.setHealthStandard(gethealthStandard(bean.getType(),bean.getUser()).toString());
                listTemp.add(bean);
            }
        }

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

@ -162,7 +162,7 @@ public class WlyyPatientDeviceService extends BaseJpaService<WlyyPatientDevice,W
        }
        
        if(StringUtils.isNotBlank(doctorName)){
            sql = sql + "AND s.doctor_name like '%"+doctorName+"%' ";
            sql = sql + "AND (s.doctor_name like '%"+doctorName+"%' or s.doctor_health_name like '%"+doctorName+"%') ";
        }
        
        if(StringUtils.isNotBlank(userName)){

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

@ -211,6 +211,8 @@
                                        }else {
                                            return "<span style='color:red;'>"+row.value1+"</span>";
                                        }
                                    }else{
                                        return row.value1;
                                    }
                                }
                            },
@ -231,6 +233,8 @@
                                        }else {
                                            return "<span style='color:red;'>"+row.value2+"</span>";
                                        }
                                    }else{
                                        return row.value2;
                                    }
                                }
                            },

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

@ -33,7 +33,7 @@
				<input type="text" id="inp_user_name" placeholder="请输入居民姓名" class="f-ml10" data-attr-scan="userName"/>
			</div>
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_doctor_name" placeholder="请输入医生姓名" class="f-ml10" data-attr-scan="doctorName"/>
				<input type="text" id="inp_doctor_name" placeholder="请输入医生/健管师姓名" class="f-ml10" data-attr-scan="doctorName"/>
			</div>
			<sec:authorize url="/admin/patientDevice/list">
				<div id="btn_search" class="l-button u-btn u-btn-primary u-btn-small f-ib f-vam  f-ml10" >