|
@@ -40,11 +40,11 @@ public class HospitalServiceImpl extends ServiceImpl<HospitalMapper, Hospital> i
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public PageUtils queryList(Integer page, Integer pageSize,Integer hospId ,String name) {
|
|
|
+ public PageUtils queryList(Integer page, Integer pageSize, Integer hospId, String name) {
|
|
|
Page<Hospital> hosptailPage = new Page<>(page, pageSize);
|
|
|
- Page<Hospital> pages = this.page(hosptailPage,new QueryWrapper<Hospital>()
|
|
|
- .lambda().eq(!StringUtils.isEmpty(hospId),Hospital::getId,hospId)
|
|
|
- .like(!StringUtils.isEmpty(name), Hospital::getName,name));
|
|
|
+ Page<Hospital> pages = this.page(hosptailPage, new QueryWrapper<Hospital>().lambda()
|
|
|
+// .eq(!StringUtils.isEmpty(hospId), Hospital::getId, hospId)
|
|
|
+ .like(!StringUtils.isEmpty(name), Hospital::getName, name));
|
|
|
List<Hospital> records = pages.getRecords();
|
|
|
List<HosptailVO> hosptailVOList = BeanUtil.convertList(records, HosptailVO.class);
|
|
|
PageUtils pageUtils = new PageUtils(pages);
|
|
@@ -58,20 +58,42 @@ public class HospitalServiceImpl extends ServiceImpl<HospitalMapper, Hospital> i
|
|
|
* @param hospitalSaveDto
|
|
|
*/
|
|
|
@Override
|
|
|
- @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public void saveHosptail(HospitalSaveDto hospitalSaveDto) {
|
|
|
+ String sign = hospitalSaveDto.getSign();
|
|
|
+ checkParam(hospitalSaveDto, sign);
|
|
|
Hospital hospital = BeanUtil.convertObj(hospitalSaveDto, Hospital.class);
|
|
|
hospital.setCreateTime(System.currentTimeMillis());
|
|
|
baseMapper.insert(hospital);
|
|
|
}
|
|
|
|
|
|
+ // 校验参数
|
|
|
+ private void checkParam(HospitalSaveDto hospitalSaveDto, String sign) {
|
|
|
+ Integer isHospital = hospitalSaveDto.getIsHospital();
|
|
|
+ if (isHospital == 0) {
|
|
|
+ if (StringUtils.isEmpty(sign)) {
|
|
|
+ throw new CostException(500, "新增医院请选择医院标识");
|
|
|
+ }
|
|
|
+ Hospital bySign = this.getBySign(sign);
|
|
|
+ if (Objects.nonNull(bySign)) {
|
|
|
+ throw new CostException(500, "当前医院标识已存在,请重新生成");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ Integer parentId = hospitalSaveDto.getParentId();
|
|
|
+ // 校验参数
|
|
|
+ if (parentId == 0) {
|
|
|
+ throw new CostException(500, "新增院区请选择医院");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 修改医院信息
|
|
|
*
|
|
|
* @param hospitalDto
|
|
|
*/
|
|
|
@Override
|
|
|
- @Transactional(propagation = Propagation.REQUIRED,rollbackFor = Exception.class)
|
|
|
+ @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
|
|
|
public void updateByHosptail(HospitalDto hospitalDto) {
|
|
|
Hospital hospital = baseMapper.selectOne(new QueryWrapper<Hospital>().lambda().
|
|
|
eq(!StringUtils.isEmpty(hospitalDto.getId()), Hospital::getId, hospitalDto.getId()));
|
|
@@ -101,6 +123,7 @@ public class HospitalServiceImpl extends ServiceImpl<HospitalMapper, Hospital> i
|
|
|
|
|
|
/**
|
|
|
* 通过医院标识获取院区列表
|
|
|
+ *
|
|
|
* @param sign
|
|
|
* @return
|
|
|
*/
|
|
@@ -123,6 +146,7 @@ public class HospitalServiceImpl extends ServiceImpl<HospitalMapper, Hospital> i
|
|
|
|
|
|
/**
|
|
|
* 通过医院sign获取医院信息
|
|
|
+ *
|
|
|
* @param hospSign 医院唯一标识
|
|
|
* @return
|
|
|
*/
|