|
@@ -7,9 +7,9 @@ import com.imed.costaccount.common.exception.CostException;
|
|
|
import com.imed.costaccount.common.util.PageUtils;
|
|
|
import com.imed.costaccount.mapper.HosptailMapper;
|
|
|
import com.imed.costaccount.model.Hosptail;
|
|
|
-import com.imed.costaccount.model.User;
|
|
|
+import com.imed.costaccount.model.dto.HosptailDto;
|
|
|
import com.imed.costaccount.model.vo.CommonVO;
|
|
|
-import com.imed.costaccount.model.vo.UserVO;
|
|
|
+import com.imed.costaccount.model.vo.HosptailVO;
|
|
|
import com.imed.costaccount.service.HosptailService;
|
|
|
import com.imed.costaccount.utils.BeanUtil;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -17,9 +17,8 @@ import org.springframework.stereotype.Service;
|
|
|
import java.util.*;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
-
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
|
|
|
|
|
|
@Service("hosptailService")
|
|
@@ -33,16 +32,49 @@ public class HosptailServiceImpl extends ServiceImpl<HosptailMapper, Hosptail> i
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public PageUtils queryList(Integer page, Integer pageSize) {
|
|
|
-// Page<Hosptail> hosptailPage = new Page<>(page, pageSize);
|
|
|
-// Page<Hosptail> pages = this.page(hosptailPage);
|
|
|
-// List<UserVO> userVOS = com.imed.costaccount.common.util.BeanUtil.convertList(records, UserVO.class);
|
|
|
-// PageUtils pageUtils = new PageUtils(pages);
|
|
|
-// pageUtils.setList(userVOS);
|
|
|
-// return pageUtils;
|
|
|
- return null;
|
|
|
+ public PageUtils queryList(Integer page, Integer pageSize,String name) {
|
|
|
+ Page<Hosptail> hosptailPage = new Page<>(page, pageSize);
|
|
|
+ Page<Hosptail> pages = this.page(hosptailPage,new QueryWrapper<Hosptail>()
|
|
|
+ .lambda().like(!StringUtils.isEmpty(name),Hosptail::getName,name));
|
|
|
+ List<Hosptail> records = pages.getRecords();
|
|
|
+ List<HosptailVO> hosptailVOList = BeanUtil.convertList(records, HosptailVO.class);
|
|
|
+ PageUtils pageUtils = new PageUtils(pages);
|
|
|
+ pageUtils.setList(hosptailVOList);
|
|
|
+ return pageUtils;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加医院信息
|
|
|
+ *
|
|
|
+ * @param hosptailDto
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void saveHosptail(HosptailDto hosptailDto) {
|
|
|
+ // TODO 可能需要补充没有传递的数据
|
|
|
+ Hosptail hosptail = BeanUtil.convertObj(hosptailDto, Hosptail.class);
|
|
|
+ hosptail.setCreateTime(System.currentTimeMillis());
|
|
|
+ baseMapper.insert(hosptail);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改医院信息
|
|
|
+ *
|
|
|
+ * @param hosptailDto
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public void updateByHosptail(HosptailDto hosptailDto) {
|
|
|
+ Hosptail hosptail = baseMapper.selectOne(new QueryWrapper<Hosptail>().lambda().
|
|
|
+ eq(!StringUtils.isEmpty(hosptailDto.getId()), Hosptail::getId, hosptailDto.getId()));
|
|
|
+ if (Objects.isNull(hosptail)) {
|
|
|
+ throw new CostException("不存在相关医院信息");
|
|
|
+ }
|
|
|
+ baseMapper.deleteById(hosptail.getId());
|
|
|
+ Hosptail hosptailRequest = BeanUtil.convertObj(hosptailDto, Hosptail.class);
|
|
|
+ hosptailRequest.setId(null);
|
|
|
+ baseMapper.insert(hosptailRequest);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 通过医院标识获取院区列表
|
|
|
* @param sign
|