zdm 6 роки тому
батько
коміт
b07d5883f2

+ 33 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/population/BasePopulationDO.java

@ -23,12 +23,18 @@ public class BasePopulationDO extends UuidIdentityEntityWithOperator {
    //租户名称
    @Column(name = "saas_name")
    private String  saasName;
    //租户创建时间
    @Column(name = "saas_create_time")
    private Date  saasCreateTime;
    //所属省代码
    @Column(name = "province_code")
    private String  provinceCode;
    //省份名称
    @Column(name = "province_name")
    private String  provinceName;
    //城市编码
    @Column(name = "city_code")
    private String  cityCode;
    //城市名称
    @Column(name = "city_name")
    private String  cityName;
@ -65,6 +71,9 @@ public class BasePopulationDO extends UuidIdentityEntityWithOperator {
    //任务数
    @Column(name = "task_num")
    private Integer  taskNum;
    //慢病人数
    @Column(name = "ncd_num")
    private Integer ncdNum;
    public String getSaasId() {
        return saasId;
@ -193,4 +202,28 @@ public class BasePopulationDO extends UuidIdentityEntityWithOperator {
    public void setTaskNum(Integer taskNum) {
        this.taskNum = taskNum;
    }
    public Integer getNcdNum() {
        return ncdNum;
    }
    public void setNcdNum(Integer ncdNum) {
        this.ncdNum = ncdNum;
    }
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
    public Date getSaasCreateTime() {
        return saasCreateTime;
    }
    public void setSaasCreateTime(Date saasCreateTime) {
        this.saasCreateTime = saasCreateTime;
    }
}

+ 120 - 121
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/population/BasePopulationVO.java

@ -4,6 +4,8 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.persistence.Column;
import java.util.Date;
@ -22,121 +24,107 @@ import java.util.Date;
@ApiModel(value = "BasePopulationVO", description = "基础人口基数信息")
public class BasePopulationVO extends UuidIdentityVOWithOperator {
    /**
	 * saas化的id
	 */
	@ApiModelProperty(value = "saas化的id", example = "402803ee656498890165649ad2da1112")
    private String saasId;
    /**
	 * 所属省代码
	 */
	@ApiModelProperty(value = "所属省代码", example = "参考省代码")
    private String provinceCode;
    /**
	 * 所属市代码
	 */
	@ApiModelProperty(value = "所属市代码", example = "参考市代码")
    private String cityCode;
    /**
	 * 所属区代码
	 */
	@ApiModelProperty(value = "所属区代码", example = "参考区代码")
    private String districtCode;
    /**
	 * 所属具体名称
	 */
	@ApiModelProperty(value = "所属具体名称", example = "")
    private String name;
    /**
	 * 人口数
	 */
	@ApiModelProperty(value = "人口数", example = "自然数")
    private Integer populationNum;
    /**
	 * 类别 0是省,1是市,2是区,3是机构
	 */
	@ApiModelProperty(value = "类别 0是省,1是市,2是区,3是机构", example = "0")
    private String type;
    /**
	 * 每年的人口数
	 */
	@ApiModelProperty(value = "每年的人口数", example = "自然数")
    private Integer year;
    /**
	 * 高血压发病数,HBP为医学简称
	 */
	@ApiModelProperty(value = "高血压发病数,HBP为医学简称", example = "模块1")
    private Integer hbpNum;
    /**
	 * 糖尿病发病数,DM为医学简称
	 */
	@ApiModelProperty(value = "糖尿病发病数,DM为医学简称", example = "模块1")
    private Integer dmNum;
    /**
	 * 65岁以上老年人口数
	 */
	@ApiModelProperty(value = "65岁以上老年人口数", example = "自然数")
    private Integer olderThan65Num;
    /**
	 * 高血压任务数
	 */
	@ApiModelProperty(value = "高血压任务数", example = "自然数")
    private Integer hbpTaskNum;
    /**
	 * 糖尿病任务数
	 */
	@ApiModelProperty(value = "糖尿病任务数", example = "自然数")
    private Integer dmTaskNum;
    /**
	 * 65岁以上老年人口任务数
	 */
	@ApiModelProperty(value = "65岁以上老年人口任务数", example = "自然数")
    private Integer olderThan65TaskNum;
    /**
	 * 户籍人口任务数
	 */
	@ApiModelProperty(value = "户籍人口任务数", example = "自然数")
    private Integer taskNum;
    /**
	 * 创建时间
	 */
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
	@ApiModelProperty(value = "创建时间", example = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
    //saas化的id
    @ApiModelProperty(value = "saasId", example = "自然数")
    private String  saasId;
    //租户名称
    @ApiModelProperty(value = "租户名称", example = "i健康")
    private String  saasName;
    //所属省代码
    @ApiModelProperty(value = "所属省代码", example = "350000")
    private String  provinceCode;
    //省份名称
    @ApiModelProperty(value = "省份名称", example = "福建省")
    private String  provinceName;
    //城市名称
    @ApiModelProperty(value = "城市名称", example = "厦门市")
    private String  cityName;
    //城市名称
    @ApiModelProperty(value = "城市编码", example = "350200")
    private String  cityCode;
    //所属区代码
    @ApiModelProperty(value = "所属区代码", example = "350203")
    private String  districtCode;
    //区名
    @ApiModelProperty(value = "所属区名称", example = "思明区")
    private String  districtName;
    //户籍人口数
    @ApiModelProperty(value = "户籍人口数", example = "自然数")
    private Integer  regisPopulationNum ;
    //常住人口数
    @ApiModelProperty(value = "常住人口数", example = "自然数")
    private Integer  populationNum;
    //类别 0是省,1是市,2是区,3是机构
    @ApiModelProperty(value = "类别 0是省,1是市,2是区,3是机构", example = "自然数")
    private String  type;
    //时间(年份)
    @ApiModelProperty(value = "时间", example = "2018年")
    private String  year;
    // 高血压人口数,HBP为医学简称
    @ApiModelProperty(value = "高血压人口数", example = "自然数")
    private Integer  hbpNum;
    // 糖尿病人口数,DM为医学简称
    @ApiModelProperty(value = "糖尿病人口数", example = "自然数")
    private Integer  dmNum;
    //高血压任务数
    @ApiModelProperty(value = "高血压任务数", example = "自然数")
    private Integer  hbpTaskNum;
    //糖尿病任务数
    @ApiModelProperty(value = "糖尿病任务数", example = "自然数")
    private Integer  dmTaskNum;
    //任务数
    @ApiModelProperty(value = "任务数", example = "自然数")
    private Integer  taskNum;
    @ApiModelProperty(value = "慢病人数(高血压人口数+糖尿病人口数)", example = "自然数")
    private Integer ncdNum;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    @ApiModelProperty(value = "租户创建时间", example = "yyyy-MM-dd HH:mm:ss")
    private Date  saasCreateTime;
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getSaasName() {
        return saasName;
    }
    public void setSaasName(String saasName) {
        this.saasName = saasName;
    }
    public String getProvinceCode() {
        return provinceCode;
    }
    public void setProvinceCode(String provinceCode) {
        this.provinceCode = provinceCode;
    }
    public String getProvinceName() {
        return provinceName;
    }
    public void setProvinceName(String provinceName) {
        this.provinceName = provinceName;
    }
    public String getCityName() {
        return cityName;
    }
    public void setCityName(String cityName) {
        this.cityName = cityName;
    }
    public String getCityCode() {
        return cityCode;
    }
    public void setCityCode(String cityCode) {
        this.cityCode = cityCode;
    }
@ -144,20 +132,31 @@ public class BasePopulationVO extends UuidIdentityVOWithOperator {
    public String getDistrictCode() {
        return districtCode;
    }
    public void setDistrictCode(String districtCode) {
        this.districtCode = districtCode;
    }
    public String getName() {
        return name;
    public String getDistrictName() {
        return districtName;
    }
    public void setDistrictName(String districtName) {
        this.districtName = districtName;
    }
    public void setName(String name) {
        this.name = name;
    public Integer getRegisPopulationNum() {
        return regisPopulationNum;
    }
    public void setRegisPopulationNum(Integer regisPopulationNum) {
        this.regisPopulationNum = regisPopulationNum;
    }
    public Integer getPopulationNum() {
        return populationNum;
    }
    public void setPopulationNum(Integer populationNum) {
        this.populationNum = populationNum;
    }
@ -165,20 +164,23 @@ public class BasePopulationVO extends UuidIdentityVOWithOperator {
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public Integer getYear() {
    public String getYear() {
        return year;
    }
    public void setYear(Integer year) {
    public void setYear(String year) {
        this.year = year;
    }
    public Integer getHbpNum() {
        return hbpNum;
    }
    public void setHbpNum(Integer hbpNum) {
        this.hbpNum = hbpNum;
    }
@ -186,20 +188,15 @@ public class BasePopulationVO extends UuidIdentityVOWithOperator {
    public Integer getDmNum() {
        return dmNum;
    }
    public void setDmNum(Integer dmNum) {
        this.dmNum = dmNum;
    }
    public Integer getOlderThan65Num() {
        return olderThan65Num;
    }
    public void setOlderThan65Num(Integer olderThan65Num) {
        this.olderThan65Num = olderThan65Num;
    }
    public Integer getHbpTaskNum() {
        return hbpTaskNum;
    }
    public void setHbpTaskNum(Integer hbpTaskNum) {
        this.hbpTaskNum = hbpTaskNum;
    }
@ -207,30 +204,32 @@ public class BasePopulationVO extends UuidIdentityVOWithOperator {
    public Integer getDmTaskNum() {
        return dmTaskNum;
    }
    public void setDmTaskNum(Integer dmTaskNum) {
        this.dmTaskNum = dmTaskNum;
    }
    public Integer getOlderThan65TaskNum() {
        return olderThan65TaskNum;
    }
    public void setOlderThan65TaskNum(Integer olderThan65TaskNum) {
        this.olderThan65TaskNum = olderThan65TaskNum;
    }
    public Integer getTaskNum() {
        return taskNum;
    }
    public void setTaskNum(Integer taskNum) {
        this.taskNum = taskNum;
    }
    public Date getCreateTime() {
        return createTime;
    public Integer getNcdNum() {
        return ncdNum;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    public void setNcdNum(Integer ncdNum) {
        this.ncdNum = ncdNum;
    }
    public Date getSaasCreateTime() {
        return saasCreateTime;
    }
    public void setSaasCreateTime(Date saasCreateTime) {
        this.saasCreateTime = saasCreateTime;
    }
}

+ 11 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/dao/area/BaseCityDao.java

@ -1,21 +1,24 @@
package com.yihu.jw.base.dao.area;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.area.BaseCityDO;
import org.springframework.data.repository.query.Param;
/**
 * 
 * 城市字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @version <pre>
 *          Author	Version		Date		Changes
 *          litaohong 	1.0  		2018年08月31日 	Created
 *
 *          </pre>
 * @since 1.
 */
public interface BaseCityDao extends PagingAndSortingRepository<BaseCityDO, Integer>, JpaSpecificationExecutor<BaseCityDO>  {
public interface BaseCityDao extends PagingAndSortingRepository<BaseCityDO, Integer>, JpaSpecificationExecutor<BaseCityDO> {
    @Query("select name from BaseCityDO where code =:code")
    String getNameByCode(@Param("code") String code);
}

+ 10 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/dao/area/BaseProvinceDao.java

@ -1,21 +1,23 @@
package com.yihu.jw.base.dao.area;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.area.BaseProvinceDO;
import org.springframework.data.repository.query.Param;
/**
 * 
 * 省字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @version <pre>
 *                   Author	Version		Date		Changes
 *                   litaohong 	1.0  		2018年08月31日 	Created
 *
 *                   </pre>
 * @since 1.
 */
public interface BaseProvinceDao extends PagingAndSortingRepository<BaseProvinceDO, Integer>, JpaSpecificationExecutor<BaseProvinceDO>  {
public interface BaseProvinceDao extends PagingAndSortingRepository<BaseProvinceDO, Integer>, JpaSpecificationExecutor<BaseProvinceDO> {
    @Query("select name from BaseProvinceDO where code =:code")
    String getNameByCode(@Param("code") String code);
}

+ 11 - 8
svr/svr-base/src/main/java/com/yihu/jw/base/dao/area/BaseTownDao.java

@ -1,21 +1,24 @@
package com.yihu.jw.base.dao.area;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import com.yihu.jw.entity.base.area.BaseTownDO;
import org.springframework.data.repository.query.Param;
/**
 * 
 * 区县字典 数据库访问层
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年08月31日 	Created
 *
 * </pre>
 * @version <pre>
 *          Author	Version		Date		Changes
 *          litaohong 	1.0  		2018年08月31日 	Created
 *
 *          </pre>
 * @since 1.
 */
public interface BaseTownDao extends PagingAndSortingRepository<BaseTownDO, Integer>, JpaSpecificationExecutor<BaseTownDO>  {
public interface BaseTownDao extends PagingAndSortingRepository<BaseTownDO, Integer>, JpaSpecificationExecutor<BaseTownDO> {
    @Query("select name from BaseTownDO where code =:code")
    String getNameByCode(@Param("code") String code);
}

+ 155 - 56
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/population/BasePopulationEndpoint.java

@ -1,7 +1,13 @@
package com.yihu.jw.base.endpoint.population;
import com.yihu.jw.base.service.area.BaseCityService;
import com.yihu.jw.base.service.area.BaseProvinceService;
import com.yihu.jw.base.service.area.BaseTownService;
import com.yihu.jw.base.service.population.BasePopulationService;
import com.yihu.jw.base.service.saas.SaasService;
import com.yihu.jw.entity.base.area.BaseTownDO;
import com.yihu.jw.entity.base.population.BasePopulationDO;
import com.yihu.jw.entity.base.saas.SaasDO;
import com.yihu.jw.restmodel.base.population.BasePopulationVO;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.web.ListEnvelop;
@ -12,93 +18,186 @@ import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;
/**
*
* 基础人口基数信息控制器
*
* @version
* <pre>
 * Author	Version		Date		Changes
 * litaohong 	1.0  		2018年09月26日 	update
 * 基础人口基数信息控制器
 *
 * </pre>
* @since 1.
*/
 * @version <pre>
 *                                                       Author	Version		Date		Changes
 *                                                       litaohong 	1.0  		2018年09月26日 	update
 *
 *                                                       </pre>
 * @since 1.
 */
@RestController
@RequestMapping(value = BaseRequestMapping.BasePopulation.PREFIX)
@Api(value = "基础人口基数信息管理", description = "基础人口基数信息管理服务接口", tags = {"wlyy基础服务 - 基础人口基数信息管理服务接口"})
public class BasePopulationEndpoint extends EnvelopRestEndpoint {
@Autowired
private BasePopulationService basePopulationService;
@PostMapping(value = BaseRequestMapping.BasePopulation.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
@ApiOperation(value = "创建")
public ObjEnvelop<BasePopulationVO> create (
    @ApiParam(name = "json_data", value = "Json数据", required = true)
    @RequestBody String jsonData) throws Exception {
    BasePopulationDO basePopulation = toEntity(jsonData, BasePopulationDO.class);
    basePopulation = basePopulationService.save(basePopulation);
    return success(basePopulation, BasePopulationVO.class);
    @Autowired
    private BasePopulationService basePopulationService;
    @Autowired
    private SaasService saasService;
    @Autowired
    private BaseTownService baseTownService;
    @Autowired
    private BaseProvinceService baseProvinceService;
    @Autowired
    private BaseCityService baseCityService;
    @PostMapping(value = BaseRequestMapping.BasePopulation.CREATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建")
    public ObjEnvelop<BasePopulationVO> create(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        BasePopulationDO basePopulation = toEntity(jsonData, BasePopulationDO.class);
        //根据saasid获取所属机构的行政区划
        if (StringUtils.isNotBlank(basePopulation.getSaasId())) {
            basePopulation = updateBasePopulation(basePopulation);
        } else {
            return failed("租户id不能为空!", ObjEnvelop.class);
        }
        basePopulation = basePopulationService.save(basePopulation);
        return success(basePopulation, BasePopulationVO.class);
    }
    @PostMapping(value = BaseRequestMapping.BasePopulation.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
    @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
    @RequestParam(value = "ids") String ids) {
    basePopulationService.delete(ids.split(","));
    return success("删除成功");
            @ApiParam(name = "ids", value = "id串,中间用,分隔", required = true)
            @RequestParam(value = "ids") String ids) {
        basePopulationService.delete(ids.split(","));
        return success("删除成功");
    }
    @PostMapping(value = BaseRequestMapping.BasePopulation.UPDATE, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "更新")
    public ObjEnvelop<BasePopulationVO> update (
        @ApiParam(name = "json_data", value = "Json数据", required = true)
        @RequestBody String jsonData) throws Exception {
    public ObjEnvelop<BasePopulationVO> update(
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        BasePopulationDO basePopulation = toEntity(jsonData, BasePopulationDO.class);
        if (null == basePopulation.getId()) {
        return failed("ID不能为空", ObjEnvelop.class);
            return failed("ID不能为空", ObjEnvelop.class);
        }
        //根据saasid获取所属机构的行政区划
        if (StringUtils.isNotBlank(basePopulation.getSaasId())) {
            basePopulation = updateBasePopulation(basePopulation);
        } else {
            return failed("租户id不能为空!", ObjEnvelop.class);
        }
        basePopulation = basePopulationService.save(basePopulation);
        return success(basePopulation, BasePopulationVO.class);
    }
    @GetMapping(value = BaseRequestMapping.BasePopulation.PAGE)
    @ApiOperation(value = "基数统计-获取分页")
    public PageEnvelop<BasePopulationVO> page(
            @ApiParam(name = "saasName", value = "租户名称,支持模糊搜索")
            @RequestParam(value = "saasName", required = false) String saasName,
            @ApiParam(name = "provinceCode", value = "省份编码")
            @RequestParam(value = "provinceCode", required = false) String provinceCode,
            @ApiParam(name = "cityCode", value = "城市编码")
            @RequestParam(value = "cityCode", required = false) String cityCode,
            @ApiParam(name = "year", value = "时间")
            @RequestParam(value = "year", required = false) String year,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
        StringBuffer s = new StringBuffer();
        if (StringUtils.isNotBlank(saasName)) {
            s.append("saasName?" + saasName + " g1;");
        }
        if (StringUtils.isNotBlank(provinceCode)) {
            s.append("provinceCode=" + provinceCode);
        }
        if (StringUtils.isNotBlank(cityCode)) {
            s.append("cityCode=" + cityCode);
        }
        if (StringUtils.isNotBlank(year)) {
            s.append("year=" + year);
        }
        //时间(最近时间排最前)>租户创建时间(最新创建租户排最前)
        String sorts = "-createTime,-saasCreateTime";
        String filters = s.toString();
        List<BasePopulationDO> basePopulations = basePopulationService.search(null, filters, sorts, page, size);
        int count = (int) basePopulationService.getCount(filters);
        return success(basePopulations, count, page, size, BasePopulationVO.class);
    }
        @GetMapping(value = BaseRequestMapping.BasePopulation.PAGE)
        @ApiOperation(value = "获取分页")
        public PageEnvelop<BasePopulationVO> page (
    @GetMapping(value = BaseRequestMapping.BasePopulation.LIST)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<BasePopulationVO> list(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "page", value = "分页大小", required = true, defaultValue = "1")
            @RequestParam(value = "page") int page,
            @ApiParam(name = "size", value = "页码", required = true, defaultValue = "15")
            @RequestParam(value = "size") int size) throws Exception {
            List<BasePopulationDO> basePopulations = basePopulationService.search(fields, filters, sorts, page, size);
                int count = (int)basePopulationService.getCount(filters);
                return success(basePopulations, count, page, size, BasePopulationVO.class);
         }
         @GetMapping(value = BaseRequestMapping.BasePopulation.LIST)
         @ApiOperation(value = "获取列表")
         public ListEnvelop<BasePopulationVO> list (
             @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
             @RequestParam(value = "fields", required = false) String fields,
             @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
             @RequestParam(value = "filters", required = false) String filters,
             @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
             @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
             List<BasePopulationDO> basePopulations = basePopulationService.search(fields, filters, sorts);
                  return success(basePopulations, BasePopulationVO.class);
         }
 }
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        List<BasePopulationDO> basePopulations = basePopulationService.search(fields, filters, sorts);
        return success(basePopulations, BasePopulationVO.class);
    }
    /**
     * 根据基数中的saasid,更新基数中租户相关信息
     *
     * @param basePopulation
     * @return
     * @throws Exception
     */
    public BasePopulationDO updateBasePopulation(BasePopulationDO basePopulation) throws Exception {
        SaasDO saasDO = saasService.findById(basePopulation.getSaasId());
        basePopulation.setSaasCreateTime(saasDO.getCreateTime());
        String areaCode = saasDO.getAreaNumber();
        String filters = "province?" + areaCode + " g1;city?" + areaCode + " g1;code?" + areaCode + " g1;";
        List<BaseTownDO> baseTowns = baseTownService.search(filters);
        BaseTownDO baseTownDO = (null != baseTowns && baseTowns.size() > 0 ? baseTowns.get(0) : null);
        if (null != baseTownDO) {
            if (baseTownDO.getCode().equals(areaCode)) {
                basePopulation.setProvinceCode(baseTownDO.getProvince());
                basePopulation.setProvinceName(baseProvinceService.getNameByCode(baseTownDO.getProvince()));
                //市编码
                basePopulation.setCityCode(baseTownDO.getCity());
                basePopulation.setCityName(baseCityService.getNameByCode(baseTownDO.getCity()));
                //区县编码
                basePopulation.setDistrictCode(areaCode);
                basePopulation.setDistrictName(baseTownDO.getName());
            } else if (baseTownDO.getCity().equals(areaCode)) {
                basePopulation.setProvinceCode(baseTownDO.getProvince());
                basePopulation.setProvinceName(baseProvinceService.getNameByCode(baseTownDO.getProvince()));
                //市编码
                basePopulation.setCityCode(areaCode);
                basePopulation.setCityName(baseCityService.getNameByCode(areaCode));
                //区县编码
                basePopulation.setDistrictCode("");
                basePopulation.setDistrictName("");
            } else if (baseTownDO.getProvince().equals(areaCode)) {
                //省编码
                basePopulation.setProvinceCode(areaCode);
                basePopulation.setProvinceName(baseProvinceService.getNameByCode(areaCode));
                //市编码
                basePopulation.setCityCode("");
                basePopulation.setCityName("");
                //区县编码
                basePopulation.setDistrictCode("");
                basePopulation.setDistrictName("");
            }
        }
        //更新慢病总人数
        basePopulation.setNcdNum(basePopulation.getHbpNum() + basePopulation.getDmNum());
        return basePopulation;
    }
}

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/saas/SaasTypeDictEndpoint.java

@ -95,7 +95,7 @@ public class SaasTypeDictEndpoint extends EnvelopRestEndpoint {
            @RequestParam(value = "size") int size) throws Exception {
        StringBuffer s = new StringBuffer();
        if (StringUtils.isNotEmpty(name)) {
            s.append("name?" + name + "g1;");
            s.append("name?" + name + " g1;");
        }
        if (null != status) {
            s.append("status=" + status);

+ 12 - 7
svr/svr-base/src/main/java/com/yihu/jw/base/service/area/BaseCityService.java

@ -2,21 +2,26 @@ package com.yihu.jw.base.service.area;
import com.yihu.jw.base.dao.area.BaseCityDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.area.BaseCityDO;
/**
 * 
 * 城市字典服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年08月31日 Created
 *
 * </pre>
 * @version <pre>
 *          Author	Version		Date		Changes
 *          litaohong    1.0  2018年08月31日 Created
 *
 *          </pre>
 * @since 1.
 */
@Service
public class BaseCityService extends BaseJpaService<BaseCityDO, BaseCityDao> {
    @Autowired
    private BaseCityDao baseCityDao;
    public String getNameByCode(String code) {
        return baseCityDao.getNameByCode(code);
    }
}

+ 12 - 7
svr/svr-base/src/main/java/com/yihu/jw/base/service/area/BaseProvinceService.java

@ -2,21 +2,26 @@ package com.yihu.jw.base.service.area;
import com.yihu.jw.base.dao.area.BaseProvinceDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.area.BaseProvinceDO;
/**
 * 
 * 省字典服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年08月31日 Created
 *
 * </pre>
 * @version <pre>
 *                   Author	Version		Date		Changes
 *                   litaohong    1.0  2018年08月31日 Created
 *
 *                   </pre>
 * @since 1.
 */
@Service
public class BaseProvinceService extends BaseJpaService<BaseProvinceDO, BaseProvinceDao> {
    @Autowired
    private BaseProvinceDao baseProvinceDao;
    public String getNameByCode(String code) {
        return baseProvinceDao.getNameByCode(code);
    }
}

+ 12 - 7
svr/svr-base/src/main/java/com/yihu/jw/base/service/area/BaseTownService.java

@ -2,21 +2,26 @@ package com.yihu.jw.base.service.area;
import com.yihu.jw.base.dao.area.BaseTownDao;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yihu.jw.entity.base.area.BaseTownDO;
/**
 * 
 * 区县字典服务service
 * 
 * @version 
 * <pre>
 * Author	Version		Date		Changes
 * litaohong    1.0  2018年08月31日 Created
 *
 * </pre>
 * @version <pre>
 *                   Author	Version		Date		Changes
 *                   litaohong    1.0  2018年08月31日 Created
 *
 *                   </pre>
 * @since 1.
 */
@Service
public class BaseTownService extends BaseJpaService<BaseTownDO, BaseTownDao> {
    @Autowired
    private BaseTownDao baseTownDao;
    public String getNameByCode(String code) {
        return baseTownDao.getNameByCode(code);
    }
}

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/population/BaseYearService.java

@ -24,11 +24,11 @@ public class BaseYearService extends BaseJpaService<BaseYearDO, BaseYearDao> {
    public boolean save(int year) {
        BaseYearDO baseYearDo;
        List<BaseYearDO> baseYearDOList=new ArrayList<>();
        for( int i=year;i<1990;i--){
        for( int i=year;i>1989;i--){
            baseYearDo=new BaseYearDO();
            String uuid=getCode();
            baseYearDo.setId(uuid);
            baseYearDo.setYear(year+"年");
            baseYearDo.setYear(i+"年");
            baseYearDOList.add(baseYearDo);
        }
        baseYearDao.save(baseYearDOList);

+ 4 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/saas/SaasService.java

@ -92,4 +92,8 @@ public class SaasService extends BaseJpaService<SaasDO, SaasDao> {
        }
    }
    public SaasDO findById(String id){
        return saasDao.findById(id);
    }
}