liuwenbin 7 роки тому
батько
коміт
c2d98eb8c0

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

@ -45,11 +45,12 @@ public class DeviceHealthIndexController extends BaseController{
            @RequestParam(value = "indexTypeMax1",required = false) Integer indexTypeMax1,
            @RequestParam(value = "indexTypeMin2",required = false) Integer indexTypeMin2,
            @RequestParam(value = "indexTypeMax2",required = false) Integer indexTypeMax2,
            @RequestParam(value = "doctorName",required = false) String doctorName,
            @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,indexTypeMin1, indexTypeMax1, indexTypeMin2,indexTypeMax2);
            Page<DeviceHealthIndexVO> deviceHealthIndexes = healthIndexService.searchList(deviceSn,date, idcard, userName, indexType,page, pageSize,indexTypeMin1, indexTypeMax1, indexTypeMin2,indexTypeMax2,doctorName);
            return write(200,"操作成功",page,pageSize,deviceHealthIndexes);
        }catch (Exception ex){
            error(ex);

+ 6 - 0
patient-co-manage/wlyy-manage/src/main/java/com/yihu/wlyy/repository/SignFamilyDao.java

@ -48,4 +48,10 @@ public interface SignFamilyDao extends PagingAndSortingRepository<SignFamily, Lo
    @Query(" from SignFamily a where a.patient = ?1 and a.type = ?2 and (a.status=-3 or a.status=-4)  order by a.id desc")
    List<SignFamily> findLastJySignByPatient(String patient, int type);
    @Query("select a.patient from SignFamily a where (a.doctorName like ?1 or a.doctorHealthName like ?1) and a.status > 0")
    String[] findByDoctorName(String doctorName);
    @Query("select a.patient from SignFamily a where a.hospital=?1 and a.status > 0")
    String[] findByHospital(String hospital);
}

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

@ -4,9 +4,13 @@ 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.Doctor;
import com.yihu.wlyy.entity.Patient;
import com.yihu.wlyy.entity.User;
import com.yihu.wlyy.entity.device.PatientHealthStandard;
import com.yihu.wlyy.repository.DoctorDao;
import com.yihu.wlyy.repository.PatientDao;
import com.yihu.wlyy.repository.SignFamilyDao;
import com.yihu.wlyy.repository.WlyyPatientDeviceDao;
import com.yihu.wlyy.util.DateTimeUtil;
import com.yihu.wlyy.util.SystemConf;
@ -19,6 +23,11 @@ import org.springframework.data.domain.*;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.*;
/**
@ -37,20 +46,40 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
    private WlyyPatientDeviceDao wlyyPatientDeviceDao;
    @Autowired
    private DeviceHealthIndexDao deviceHealthIndexDao;
    @Autowired
    private SignFamilyDao signFamilyDao;
    @Autowired
    private DoctorDao doctorDao;
    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{
    Integer indexTypeMin1,Integer indexTypeMax1,Integer indexTypeMin2,Integer indexTypeMax2,String doctorName)throws Exception{
        if (page == null){
            page = 1;
        }
        if(pageSize == null){
            pageSize = 15;
        }
        HttpServletRequest request = ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getRequest();
        User loginUser = (User) request.getSession().getAttribute("userInfo");
//        HttpServletRequest request = ServletActionContext.getRequest();
//        HttpSession session = request.getSession();
        Pageable pageRequest = new PageRequest(page-1,pageSize);
        StringBuilder filter = new StringBuilder();
        //1、管理员  2、医生 0、其他
        if(loginUser.getType()==2){
            Doctor doctor = doctorDao.findByCode(loginUser.getCode());
            String[] codes =signFamilyDao.findByHospital(doctor.getHospital());
            if(codes != null && codes.length >0){
                filter.append("user="+StringUtils.join(codes, ","));
            }else {
                return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
            }
        }
        if(!StringUtils.isEmpty(deviceSn)){
            filter.append("deviceSn="+deviceSn+";");
        }
@ -77,6 +106,16 @@ public class DeviceHealthIndexService extends BaseDeviceJpaService<DeviceHealthI
                return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
            }
        }
        //根据医生名称过滤居民
        if(!StringUtils.isEmpty(doctorName)){
            String[] codes = signFamilyDao.findByDoctorName("%"+doctorName+"%");
            if(codes != null && codes.length >0){
                filter.append("user="+StringUtils.join(codes, ","));
            }else {
                return new PageImpl<DeviceHealthIndexVO>(new ArrayList<>(), pageRequest, 0);
            }
        }
        if(!StringUtils.isEmpty(indexType)){
            filter.append("type="+indexType+";");
        }

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

@ -46,6 +46,9 @@
					<span>导出</span>
				</div>
			</sec:authorize>
			<div class="m-form-control f-ml15">
				<input type="text" id="inp_doctor_name" placeholder="请输入医生/健管师名称" class="f-ml10" data-attr-scan="doctorName"/>
			</div>
			<div id="select-list" class="f-mt10" style="display: none">
				<div class="m-form-control f-ml15">
					<input type="text" id="search-min-1" placeholder="" class="f-ml10" data-attr-scan="indexTypeMin1"/>

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

@ -41,6 +41,7 @@
                $searchMax1:$("#search-max-1"),
                $searchMin2:$("#search-min-2"),
                $searchMax2:$("#search-max-2"),
                $doctorName:$("#inp_doctor_name"),
				init: function () {
					this.$element.show();
					this.$element.attrScan();
@ -59,6 +60,7 @@
					});
					this.$idcard.ligerTextBox({width: 150});
					this.$userName.ligerTextBox({width: 150});
                    this.$doctorName.ligerTextBox({width: 150});
					this.bindEvents();
                    this.typeBox = this.$indexType.ligerComboBox({
                        width: 150,
@ -118,6 +120,9 @@
                        //居民姓名
                        var userName = $("<input type='hidden' name='userName' />")
                        userName.attr('value',$("#inp_user_name").val());
                        //居民姓名
                        var doctorName = $("<input type='hidden' name='doctorName' />")
                        doctorName.attr('value',$("#inp_doctor_name").val());
                        //血糖/血压/体重/腰围
                        var indexType = $("<input type='hidden' name='indexType' />")
                        indexType.attr('value',$("#inp_index_type_val").val());
@ -137,6 +142,7 @@
                        myform.append(date);
                        myform.append(idcard);
                        myform.append(userName);
                        myform.append(doctorName);
                        myform.append(indexType);
                        myform.append(indexTypeMin1);
                        myform.append(indexTypeMax1);