Explorar o código

获取人员列表

xiaoyunquan %!s(int64=2) %!d(string=hai) anos
pai
achega
5503df32f2

+ 14 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/endpoint/statistics/OpenStatisticsEndpoint.java

@ -153,6 +153,20 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "getUserListByPage")
    @ApiOperation(value = "获取人员列表")
    public PageEnvelop getUserListByPage(@ApiParam(name = "type",value = "类型。1医生,2社工,3教师,4助老员") @RequestParam String type,
                                         @ApiParam(name = "page",value = "页码") @RequestParam Integer page,
                                         @ApiParam(name = "pageSize",value = "每页大小") @RequestParam Integer pageSize,
                                         @ApiParam(name = "name",value = "模糊搜索名字") @RequestParam(name = "name",required = false)String name,
                                         @ApiParam(name = "idCard",value = "模糊搜索身份证号") @RequestParam(name = "idCard",required = false)String idCard){
        try {
            return statisticsService.getUserListByPage(type, page, pageSize, name, idCard);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @GetMapping(value = "realTimeDataNew")
    @ApiOperation(value = "实时数据v0.7.0")
    public ObjEnvelop realTimeDataNew() {

+ 39 - 0
svr/svr-cloud-care/src/main/java/com/yihu/jw/care/service/statistics/StatisticsService.java

@ -424,6 +424,45 @@ public class StatisticsService {
        return PageEnvelop.getSuccessListWithPage("获取成功",list,page,pageSize,count);
    }
    /**
     *
     * @param type 类型。1医生,2社工,3教师,4助老员
     * @param page
     * @param pageSize
     * @param name
     * @param idCard
     * @return
     */
    public PageEnvelop getUserListByPage(String type,Integer page,Integer pageSize,String name,String idCard){
        page = page>0?page-1:0;
        String selectSql = "SELECT a.id,a.name,\n" +
                "\tCASE\n" +
                "\t\ta.sex \n" +
                "\t\tWHEN 1 THEN\n" +
                "\t\t'男' \n" +
                "\t\tWHEN 2 THEN\n" +
                "\t\t'女' ELSE a.sex \n" +
                "\tEND AS sex,\n" +
                "\tTIMESTAMPDIFF(YEAR,a.birthday,now()) AS age,\n" +
                "\ta.doctor_level,a.mobile,h.org_name,a.idcard ";
        String countSql = "select count(a.id)";
        String fromSql = " from base_doctor a,base_doctor_hospital h where a.id=h.doctor_code and a.del = '1' and h.del = '1' " +
                " and a.doctor_level is not null and h.org_code not in ( " +
                " SELECT dict_code from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org'  )  and a.doctor_level="+type+"  ";
        if(StringUtils.isNotBlank(name)){
            fromSql+=" and a.name like '%"+name+"%' ";
        }
        if(StringUtils.isNotBlank(idCard)){
            fromSql+=" and a.idcard like '%"+idCard+"%' ";
        }
        Long count = jdbcTemplate.queryForObject(countSql + fromSql, Long.class);
        fromSql+=" limit "+page*pageSize+","+pageSize;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(selectSql + fromSql);
        return PageEnvelop.getSuccessListWithPage("获取成功",list,page,pageSize,count);
    }
    // v0.7.0实时数据 照护对象、检测设备、紧急救助
    public JSONObject realTimeDataNew() throws Exception {
        JSONObject res = new JSONObject();