Browse Source

更新修改

chenweida 7 years ago
parent
commit
7656166f0d

+ 43 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/app/hospital/HospitalService.java

@ -124,7 +124,50 @@ public class HospitalService extends BaseService {
        return hosList;
    }
    /**
     * 查询医院列表数目
     *
     * @param type
     * @param province
     * @param city
     * @param town
     * @param hospitalName
     * @return
     */
    public Integer getHospitalsAllCount(Integer type, String province, String city, String town, String hospitalName,String hospitalId) {
        String sql = "select * from dm_hospital where exists (select * from wlyy_doctor where wlyy_doctor.hospital = dm_hospital.code) ";
        List<Object> args = new ArrayList<>();
        if (type != null ) {
            sql += " and level = ? ";
            args.add(type);
        }
        if (StringUtils.isNotEmpty(province)) {
            sql += " and province = ? ";
            args.add(province);
        }
        if (StringUtils.isNotEmpty(city)) {
            sql += " and city = ? ";
            args.add(city);
        }
        if (StringUtils.isNotEmpty(town)) {
            sql += " and town = ? ";
            args.add(town);
        }
        if (StringUtils.isNotEmpty(hospitalName)) {
            sql += " and name like ? ";
            args.add("%" + hospitalName + "%");
        }
        if (StringUtils.isNotEmpty(hospitalId)) {
            sql += " and code = ? ";
            args.add(hospitalId);
        }
        List<Hospital> hosList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Hospital.class));
        return hosList.size();
    }
    public List<Hospital> getHospitalsNot00(String doctorCode) {
        String sql = "SELECT " +
                "  h.* " +

+ 21 - 0
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/service/common/account/DoctorService.java

@ -132,4 +132,25 @@ public class DoctorService extends TokenService {
        return doctorList;
    }
    public Integer findDoctorCounts(String hospitalCode,String doctorName,Integer level) {
        String sql = "select * from wlyy_doctor where del=1 and status=1   ";
        List<Object> args = new ArrayList<>();
        if (!org.springframework.util.StringUtils.isEmpty(hospitalCode)) {
            sql += " and hospital = ? ";
            args.add(hospitalCode);
        }
        if (!org.springframework.util.StringUtils.isEmpty(doctorName)) {
            sql += " and name like ? ";
            args.add("%"+doctorName+"%");
        }
        if (level!=null) {
            sql += " and level = ? ";
            args.add(level);
        }
        List<Doctor> doctorList = jdbcTemplate.query(sql, args.toArray(), new BeanPropertyRowMapper(Doctor.class));
        return doctorList.size();
    }
}

+ 2 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/GcHospitalController.java

@ -41,12 +41,13 @@ public class GcHospitalController {
    ) {
        List<Hospital> hospitals = hospitalService.getHospitals(null, provinceId, cityId, townId, hospitalName, hospitalId, page, pageSize);
        ;
        List<HospitalModel> hospitalModels = new ArrayList<>();
        for (Hospital hospital : hospitals) {
            HospitalModel hospitalModel = new HospitalModel();
            BeanUtils.copyProperties(hospital, hospitalModel);
            hospitalModels.add(hospitalModel);
        }
        return new ResultPageListModel(page, pageSize, hospitalModels);
        return new ResultPageListModel(page, pageSize, hospitalService.getHospitalsAllCount(null, provinceId, cityId, townId, hospitalName, hospitalId), hospitalModels);
    }
}

+ 1 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/controller/doctor/GcDoctorController.java

@ -61,7 +61,7 @@ public class GcDoctorController {
            BeanUtils.copyProperties(one, doctorModel);
            doctorModelList.add(doctorModel);
        });
        return new ResultPageListModel(page, pageSize, doctorModelList);
        return new ResultPageListModel(page, pageSize, doctorService.findDoctorCounts(hospitalCode, name, level), doctorModelList);
    }

+ 12 - 1
patient-co/patient-co-wlyy/src/main/java/com/yihu/wlyy/web/gateway/vo/base/ResultPageListModel.java

@ -13,6 +13,8 @@ public class ResultPageListModel<T> extends BaseResultModel {
    private Integer page;
    @ApiModelProperty(value = "每页大小", required = false, access = "response")
    private Integer pageSize;
    @ApiModelProperty(value = "总数", required = false, access = "response")
    private Integer allNum;
    @ApiModelProperty(value = "返回数据", required = false, access = "response")
    private List<T> result;
@ -40,13 +42,22 @@ public class ResultPageListModel<T> extends BaseResultModel {
        this.pageSize = pageSize;
    }
    public ResultPageListModel(Integer page, Integer pageSize, List<T> result) {
    public ResultPageListModel(Integer page, Integer pageSize,Integer allNum, List<T> result) {
        this.page = page;
        this.pageSize = pageSize;
        this.result = result;
        this.allNum=allNum;
    }
    public ResultPageListModel() {
    }
    public Integer getAllNum() {
        return allNum;
    }
    public void setAllNum(Integer allNum) {
        this.allNum = allNum;
    }
}