Browse Source

获取机构列表

xiaoyunquan 3 years ago
parent
commit
83f823cdad

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

@ -132,6 +132,7 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
    @ApiOperation(value = "服务资源v0.7.0")
    public ObjEnvelop ServiceResources() {
        try {
            //机构和人员总数
            JSONObject result = statisticsService.serviceResources();
            return success(result);
        } catch (Exception e) {
@ -139,6 +140,19 @@ public class OpenStatisticsEndpoint extends EnvelopRestEndpoint {
        }
    }
    @GetMapping(value = "getOrgListByPage")
    @ApiOperation(value = "获取机构列表")
    public PageEnvelop getOrgListByPage(@ApiParam(name = "type",value = "类型。1医疗机构,3养老机构,4托育机构,6照料中心") @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){
        try {
            return statisticsService.getOrgListByPage(type, page, pageSize,name);
        }catch (Exception e){
            return failedPageEnvelopException2(e);
        }
    }
    @GetMapping(value = "realTimeDataNew")
    @ApiOperation(value = "实时数据v0.7.0")
    public ObjEnvelop realTimeDataNew() {

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

@ -329,9 +329,13 @@ public class StatisticsService {
        }
        JSONObject res = new JSONObject();
        //医疗机构
        String medicalInstitutionSql = "SELECT COUNT(1) FROM base_org WHERE (type = 1 OR type = 2) AND del = 1 " + orgFilter;
        //养老机构
        String elderlyCarServiceSql = "SELECT COUNT(1) FROM base_org WHERE type = 3 AND del = 1 and code not in ('zdjsylfwyxgszhfgs') " + orgFilter;
        //托育机构
        String childcareInstitutionsssSql = "SELECT COUNT(1) FROM base_org WHERE type = 4 AND del = 1" + orgFilter;
        //照料中心
        String careCenterNumSql = "SELECT COUNT(1) FROM base_org WHERE type = 6 AND del = 1" + orgFilter;
        //社工和教师注册人数
@ -347,18 +351,22 @@ public class StatisticsService {
        for (Map<String, Object> map : list2) {
            String archive_type = map.get("doctor_level").toString();
            Integer num = Integer.valueOf(map.get("c").toString());
            //医生
            if ("1".equals(archive_type)) {
                doctorNum = num;
                continue;
            }
            //社工
            if ("2".equals(archive_type)) {
                helperNum = num;
                continue;
            }
            //助老员
            if ("4".equals(archive_type)) {
                helper4Num = num;
                continue;
            }
            //教师
            if ("3".equals(archive_type)) {
                teacherNum = num;
            }
@ -367,7 +375,7 @@ public class StatisticsService {
        Integer elderlyCarServiceNum = jdbcTemplate.queryForObject(elderlyCarServiceSql, Integer.class);
        Integer childcareInstitutionsssNum = jdbcTemplate.queryForObject(childcareInstitutionsssSql, Integer.class);
        Integer careCenterNum = jdbcTemplate.queryForObject(careCenterNumSql, Integer.class);
        res.put("medicalInstitutionNum", medicalInstitutionNum);             //医疗结构
        res.put("medicalInstitutionNum", medicalInstitutionNum);             //医疗机构
        res.put("elderlyCarServiceNum", elderlyCarServiceNum);               //养老机构
        res.put("childcareInstitutionsssNum", childcareInstitutionsssNum);   //托育机构
        res.put("careCenterNum", careCenterNum);   //照料中心
@ -378,6 +386,44 @@ public class StatisticsService {
        return res;
    }
    /**
     * 获取机构列表
     * @param type 类型。1医疗机构,3养老机构,4托育机构,6照料中心
     * @param page
     * @param pageSize
     * @param name 名字模糊搜索
     * @return
     */
    public PageEnvelop getOrgListByPage(String type,Integer page,Integer pageSize,String name){
        page = page>0?page-1:0;
        String orgFilter = "";
        String sqlOrg = "SELECT GROUP_CONCAT(dict_code) orgCodes from wlyy_hospital_sys_dict WHERE dict_name = 'jkzl_org' ";
        List<Map<String, Object>> listOrg = jdbcTemplate.queryForList(sqlOrg);
        if (listOrg.size() > 0) {
            String orgCodes = String.valueOf(listOrg.get(0).get("orgCodes"));
            orgCodes = orgCodes.replaceAll(",", "','");
            orgFilter = " and code not in ('" + orgCodes + "')";
        }
        String typeSql = "";
        if("1".equals(type)){
            typeSql = " and (type = 1 OR type = 2) ";
        }else if("3".equals(type)){
            typeSql = " and type = "+type + " and code not in ('zdjsylfwyxgszhfgs')  ";
        } else {
            typeSql = " and type = "+type;
        }
        if(StringUtils.isNotBlank(name)){
            typeSql = typeSql + " and name like '%"+name+"%' ";
        }
        String sql = "SELECT id,code,name,alias,type,brief,address,photo,intro,mobile FROM base_org WHERE del = 1 "+typeSql+orgFilter;
        String orderSql = " ORDER BY sort limit "+page*pageSize+","+pageSize;
        String countSql = "SELECT count(*) FROM base_org WHERE del = 1 "+typeSql+orgFilter;
        List<Map<String, Object>> list = jdbcTemplate.queryForList(sql+orderSql);
        Long count = jdbcTemplate.queryForObject(countSql,Long.class);
        return PageEnvelop.getSuccessListWithPage("获取成功",list,page,pageSize,count);
    }
    // v0.7.0实时数据 照护对象、检测设备、紧急救助
    public JSONObject realTimeDataNew() throws Exception {
        JSONObject res = new JSONObject();