Browse Source

增加数据隔离

dev
luyan 2 years ago
parent
commit
a16fa72514
  1. 25
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/CommunityCareController.java
  2. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/CommunityCareDao.java
  3. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/PhysicianManageDao.java
  4. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/RecreationSportDao.java
  5. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/CommunityCareEntity.java
  6. 23
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/PhysicianManageEntity.java
  7. 26
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/RecreationSportEntity.java
  8. 19
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/CommunityCareServiceImpl.java
  9. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/PhysicianManageServiceImpl.java
  10. 18
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/RecreationSportServiceImpl.java
  11. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/CommunityCareDao.xml
  12. 6
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/PhysicianManageDao.xml
  13. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/RecreationSportDao.xml

25
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/CommunityCareController.java

@ -2,18 +2,23 @@ package com.epmet.controller;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.EpmetRequestHolder;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dao.IcResiDemandDictDao;
import com.epmet.dto.CommunityCareDTO;
import com.epmet.dto.form.CommunityCareFormDTO;
import com.epmet.dto.result.demand.DemandPageResDTO;
import com.epmet.service.CommunityCareService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
@ -30,6 +35,9 @@ public class CommunityCareController {
@Autowired
private CommunityCareService communityCareService;
@Resource
private IcResiDemandDictDao icResiDemandDictDao;
@RequestMapping("page")
public Result<PageData<CommunityCareDTO>> page(@RequestParam Map<String, Object> params) {
PageData<CommunityCareDTO> page = communityCareService.page(params);
@ -70,7 +78,22 @@ public class CommunityCareController {
@PostMapping("search")
public Result<PageData<CommunityCareDTO>> search(@RequestBody CommunityCareFormDTO dto) {
return new Result().ok(communityCareService.search(dto));
PageData<CommunityCareDTO> pageList = communityCareService.search(dto);
List<DemandPageResDTO> resDTOList = icResiDemandDictDao.pageSelect(EpmetRequestHolder.getLoginUserCustomerId(), "");
if (null != resDTOList && resDTOList.size() > 0) {
resDTOList.forEach(demand -> {
if (demand.getCategoryName().equals("服务类型")) {
demand.getChildren().forEach(child -> {
for (CommunityCareDTO care : pageList.getList()) {
if (care.getServiceType().equals(child.getCategoryCode())) {
care.setServiceType(child.getCategoryName());
}
}
});
}
});
}
return new Result().ok(pageList);
}
}

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/CommunityCareDao.java

@ -19,5 +19,6 @@ public interface CommunityCareDao extends BaseDao<CommunityCareEntity> {
List<CommunityCareDTO> search(@Param("title") String title, @Param("unitName") String unitName,
@Param("attn") String attn, @Param("onsite") String onsite,
@Param("startTime") String startTime, @Param("endTime") String endTime);
@Param("startTime") String startTime, @Param("endTime") String endTime,
@Param("orgIdPath") String orgIdPath);
}

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/PhysicianManageDao.java

@ -19,5 +19,5 @@ public interface PhysicianManageDao extends BaseDao<PhysicianManageEntity> {
List<PhysicianManageDTO> search(@Param("name") String name, @Param("idCard") String idCard,
@Param("level") String level, @Param("subOrg") String subOrg,
@Param("orgLevel") String orgLevel);
@Param("orgLevel") String orgLevel, @Param("orgIdPath") String orgIdPath);
}

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/RecreationSportDao.java

@ -19,5 +19,5 @@ public interface RecreationSportDao extends BaseDao<RecreationSportEntity> {
List<RecreationSportDTO> search(@Param("title") String title, @Param("type") String type,
@Param("apply") String apply, @Param("startTime") String startTime,
@Param("endTime") String endTime);
@Param("endTime") String endTime, @Param("orgIdPath") String orgIdPath);
}

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/CommunityCareEntity.java

@ -70,4 +70,6 @@ public class CommunityCareEntity extends BaseEpmetEntity {
*/
private String imgUrl;
private String orgIdPath;
}

23
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/PhysicianManageEntity.java

@ -12,45 +12,50 @@ import lombok.EqualsAndHashCode;
* @since v1.0.0 2023-06-20
*/
@Data
@EqualsAndHashCode(callSuper=false)
@EqualsAndHashCode(callSuper = false)
@TableName("physician_manage")
public class PhysicianManageEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/**
* 医师姓名
*/
private String name;
private String name;
/**
* 医师证件号
*/
private String idCard;
private String idCard;
/**
* 电话
*/
private String mobile;
private String mobile;
/**
* 级别(职称)
*/
private String level;
private String level;
/**
* 隶属机构
*/
private String subOrg;
private String subOrg;
/**
* 机构级别
*/
private String orgLevel;
private String orgLevel;
/**
* 识别码(医师执业证号码)
*/
private String imsi;
private String imsi;
/**
* 组织ID路径
*/
private String orgIdPath;
}

26
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/RecreationSportEntity.java

@ -14,55 +14,59 @@ import java.util.Date;
* @since v1.0.0 2023-06-20
*/
@Data
@EqualsAndHashCode(callSuper=false)
@EqualsAndHashCode(callSuper = false)
@TableName("recreation_sport")
public class RecreationSportEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
private static final long serialVersionUID = 1L;
/**
* 标题
*/
private String title;
private String title;
/**
* 类型
*/
private String type;
private String type;
/**
* 内容
*/
private String content;
private String content;
/**
* 地址
*/
private String address;
private String address;
/**
* 开始时间
*/
private Date startTime;
private Date startTime;
/**
* 结束时间
*/
private Date endTime;
private Date endTime;
/**
* 是否报名
*/
private String apply;
private String apply;
/**
* 报名开始时间
*/
private Date applyStart;
private Date applyStart;
/**
* 报名结束时间
*/
private Date applyEnd;
private Date applyEnd;
/**
* 组织ID路径
*/
private String orgIdPath;
}

19
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/CommunityCareServiceImpl.java

@ -10,14 +10,19 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.CommunityCareDao;
import com.epmet.dto.CommunityCareDTO;
import com.epmet.dto.form.CommunityCareFormDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.entity.CommunityCareEntity;
import com.epmet.remote.EpmetUserRemoteService;
import com.epmet.service.CommunityCareService;
import com.epmet.service.IcResiDemandDictService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -32,6 +37,12 @@ import java.util.Map;
@Service
public class CommunityCareServiceImpl extends BaseServiceImpl<CommunityCareDao, CommunityCareEntity> implements CommunityCareService {
@Resource
private EpmetUserRemoteService remoteService;
@Autowired
private IcResiDemandDictService icResiDemandDictService;
@Override
public PageData<CommunityCareDTO> page(Map<String, Object> params) {
IPage<CommunityCareEntity> page = baseDao.selectPage(
@ -74,6 +85,9 @@ public class CommunityCareServiceImpl extends BaseServiceImpl<CommunityCareDao,
if (null != dto.getReleaseTime()) {
entity.setReleaseTime(DateUtil.parseDate(dto.getReleaseTime()));
}
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails();
String orgIdPath = userDetails.getOrgIdPath();//社区级别的orgIdPath
entity.setOrgIdPath(orgIdPath);
insert(entity);
}
@ -96,8 +110,11 @@ public class CommunityCareServiceImpl extends BaseServiceImpl<CommunityCareDao,
@Override
public PageData<CommunityCareDTO> search(CommunityCareFormDTO dto) {
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails();
String orgIdPath = userDetails.getOrgIdPath();//社区级别的orgIdPath
PageInfo<CommunityCareDTO> pageInfo = PageHelper.startPage(dto.getPageNo(), dto.getPageSize(), dto.getIsPage())
.doSelectPageInfo(() -> baseDao.search(dto.getTitle(), dto.getUnitName(), dto.getAttn(), dto.getOnsiteServices(), dto.getStartTime(), dto.getEndTime()));
.doSelectPageInfo(() -> baseDao.search(dto.getTitle(), dto.getUnitName(), dto.getAttn(), dto.getOnsiteServices(),
dto.getStartTime(), dto.getEndTime(), orgIdPath));
if (null != pageInfo.getList() && pageInfo.getList().size() > 0) {
buildDate(pageInfo.getList());
}

18
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/PhysicianManageServiceImpl.java

@ -9,7 +9,9 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.PhysicianManageDao;
import com.epmet.dto.PhysicianManageDTO;
import com.epmet.dto.form.PhysicianManageFormDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.entity.PhysicianManageEntity;
import com.epmet.remote.EpmetUserRemoteService;
import com.epmet.service.PhysicianManageService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -17,6 +19,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -31,6 +34,9 @@ import java.util.Map;
@Service
public class PhysicianManageServiceImpl extends BaseServiceImpl<PhysicianManageDao, PhysicianManageEntity> implements PhysicianManageService {
@Resource
private EpmetUserRemoteService remoteService;
@Override
public PageData<PhysicianManageDTO> page(Map<String, Object> params) {
IPage<PhysicianManageEntity> page = baseDao.selectPage(
@ -49,10 +55,10 @@ public class PhysicianManageServiceImpl extends BaseServiceImpl<PhysicianManageD
private QueryWrapper<PhysicianManageEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
String orgPath = remoteService.getLoginUserDetails().getOrgIdPath();
QueryWrapper<PhysicianManageEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
wrapper.likeRight(StringUtils.isNotBlank(orgPath), "ORG_ID_PATH", orgPath);
return wrapper;
}
@ -66,6 +72,9 @@ public class PhysicianManageServiceImpl extends BaseServiceImpl<PhysicianManageD
@Transactional(rollbackFor = Exception.class)
public void save(PhysicianManageFormDTO dto) {
PhysicianManageEntity entity = ConvertUtils.sourceToTarget(dto, PhysicianManageEntity.class);
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails();
String orgIdPath = userDetails.getOrgIdPath();//社区级别的orgIdPath
entity.setOrgIdPath(orgIdPath);
insert(entity);
}
@ -85,8 +94,11 @@ public class PhysicianManageServiceImpl extends BaseServiceImpl<PhysicianManageD
@Override
public PageData<PhysicianManageDTO> search(PhysicianManageFormDTO dto) {
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails();
String orgIdPath = userDetails.getOrgIdPath();//社区级别的orgIdPath
PageInfo<PhysicianManageDTO> pageInfo = PageHelper.startPage(dto.getPageNo(), dto.getPageSize(), dto.getIsPage())
.doSelectPageInfo(() -> baseDao.search(dto.getName(), dto.getIdCard(), dto.getLevel(), dto.getSubOrg(), dto.getOrgLevel()));
.doSelectPageInfo(() -> baseDao.search(dto.getName(), dto.getIdCard(), dto.getLevel(), dto.getSubOrg(),
dto.getOrgLevel(), orgIdPath));
return new PageData<>(pageInfo.getList() == null ? new ArrayList<>() : pageInfo.getList(), pageInfo.getTotal());
}

18
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/RecreationSportServiceImpl.java

@ -10,7 +10,9 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.RecreationSportDao;
import com.epmet.dto.RecreationSportDTO;
import com.epmet.dto.form.RecreationSportFormDTO;
import com.epmet.dto.result.LoginUserDetailsResultDTO;
import com.epmet.entity.RecreationSportEntity;
import com.epmet.remote.EpmetUserRemoteService;
import com.epmet.service.RecreationSportService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
@ -18,6 +20,7 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@ -32,6 +35,9 @@ import java.util.Map;
@Service
public class RecreationSportServiceImpl extends BaseServiceImpl<RecreationSportDao, RecreationSportEntity> implements RecreationSportService {
@Resource
private EpmetUserRemoteService remoteService;
@Override
public PageData<RecreationSportDTO> page(Map<String, Object> params) {
IPage<RecreationSportEntity> page = baseDao.selectPage(
@ -50,10 +56,11 @@ public class RecreationSportServiceImpl extends BaseServiceImpl<RecreationSportD
private QueryWrapper<RecreationSportEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails();
String orgIdPath = userDetails.getOrgIdPath();//社区级别的orgIdPath
QueryWrapper<RecreationSportEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
wrapper.likeRight(StringUtils.isNotBlank(orgIdPath), "ORG_ID_PATH", orgIdPath);
return wrapper;
}
@ -67,6 +74,9 @@ public class RecreationSportServiceImpl extends BaseServiceImpl<RecreationSportD
@Transactional(rollbackFor = Exception.class)
public void save(RecreationSportFormDTO dto) {
RecreationSportEntity entity = ConvertUtils.sourceToTarget(dto, RecreationSportEntity.class);
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails();
String orgIdPath = userDetails.getOrgIdPath();//社区级别的orgIdPath
entity.setOrgIdPath(orgIdPath);
insert(entity);
}
@ -86,9 +96,11 @@ public class RecreationSportServiceImpl extends BaseServiceImpl<RecreationSportD
@Override
public PageData<RecreationSportDTO> search(RecreationSportFormDTO dto) {
LoginUserDetailsResultDTO userDetails = remoteService.getLoginUserDetails();
String orgIdPath = userDetails.getOrgIdPath();//社区级别的orgIdPath
PageInfo<RecreationSportDTO> pageInfo = PageHelper.startPage(dto.getPageNo(), dto.getPageSize(), dto.getIsPage())
.doSelectPageInfo(() -> baseDao.search(dto.getTitle(), dto.getType(), dto.getApply(),
DateUtil.formatDateTime(dto.getStartTime()), DateUtil.formatDateTime(dto.getEndTime())));
DateUtil.formatDateTime(dto.getStartTime()), DateUtil.formatDateTime(dto.getEndTime()), orgIdPath));
return new PageData<>(pageInfo.getList() == null ? new ArrayList<>() : pageInfo.getList(), pageInfo.getTotal());
}

3
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/CommunityCareDao.xml

@ -15,6 +15,7 @@
<result property="content" column="CONTENT"/>
<result property="onsiteServices" column="ONSITE_SERVICES"/>
<result property="imgUrl" column="IMG_URL"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
@ -39,7 +40,7 @@
cc.IMG_URL
FROM community_care cc
<where>
cc.DEL_FLAG = 0
cc.DEL_FLAG = 0 AND cc.ORG_ID_PATH LIKE concat(#{orgIdPath},'%')
<if test="null != title and title != ''">
AND cc.TITLE LIKE concat('%',#{title},'%')
</if>

6
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/PhysicianManageDao.xml

@ -12,6 +12,7 @@
<result property="subOrg" column="SUB_ORG"/>
<result property="orgLevel" column="ORG_LEVEL"/>
<result property="imsi" column="IMSI"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
@ -34,7 +35,7 @@
<include refid="returnMap"/>
FROM physician_manage pm
<where>
pm.DEL_FLAG = 0
pm.DEL_FLAG = 0 AND pm.ORG_ID_PATH LIKE concat(#{orgIdPath}, '%')
<if test="null != name and name != ''">
AND pm.NAME LIKE concat('%',#{name},'%')
</if>
@ -44,7 +45,7 @@
<if test="null != subOrg and subOrg != ''">
AND pm.SUB_ORG LIKE concat('%',#{subOrg},'%')
</if>
<if test="null != level and level != ''">
<if test="null != level">
AND pm.LEVEL = #{level}
</if>
<if test="null != orgLevel and orgLevel != ''">
@ -53,5 +54,4 @@
</where>
</select>
</mapper>

3
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/RecreationSportDao.xml

@ -14,6 +14,7 @@
<result property="apply" column="APPLY"/>
<result property="applyStart" column="APPLY_START"/>
<result property="applyEnd" column="APPLY_END"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
@ -40,7 +41,7 @@
<include refid="returnMap"/>
FROM recreation_sport rs
<where>
rs.DEL_FLAG = 0
rs.DEL_FLAG = 0 AND rs.ORG_ID_PATH LIKE concat(#{orgIdPath},'%')
<if test="null != title and title != ''">
AND rs.TITLE LIKE concat('%',#{title},'%')
</if>

Loading…
Cancel
Save