|
@@ -2,17 +2,23 @@ package com.lantone.security.facade;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.additional.query.impl.LambdaQueryChainWrapper;
|
|
|
+import com.lantone.common.dto.GetRealHospitalDTO;
|
|
|
import com.lantone.common.enums.IsDeleteEnum;
|
|
|
+import com.lantone.common.enums.StatusEnum;
|
|
|
import com.lantone.common.exception.ApiException;
|
|
|
import com.lantone.common.util.StringUtil;
|
|
|
import com.lantone.common.util.SysUserUtils;
|
|
|
import com.lantone.common.vo.GetHospitalSetVO;
|
|
|
import com.lantone.common.vo.SaveHospitalSetVO;
|
|
|
+import com.lantone.dblayermbg.entity.Hospital;
|
|
|
import com.lantone.dblayermbg.entity.HospitalSet;
|
|
|
+import com.lantone.dblayermbg.facade.HospitalFacade;
|
|
|
import com.lantone.dblayermbg.facade.HospitalSetFacade;
|
|
|
+import com.lantone.security.enums.HospitalTypeEnum;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
+import java.util.ArrayList;
|
|
|
import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
@@ -27,6 +33,9 @@ import java.util.stream.Collectors;
|
|
|
public class HospitalSetManagementFacade {
|
|
|
@Autowired
|
|
|
private HospitalSetFacade hospitalSetFacade;
|
|
|
+ @Autowired
|
|
|
+ private HospitalFacade hospitalFacade;
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* @Description: 新增参数
|
|
@@ -82,6 +91,17 @@ public class HospitalSetManagementFacade {
|
|
|
hospitalSetLambdaQuery.eq(null != getHospitalSetVO.getId(),HospitalSet::getId, getHospitalSetVO.getId());
|
|
|
hospitalSetLambdaQuery.orderByDesc(HospitalSet::getGmtCreate);
|
|
|
IPage<HospitalSet> page = hospitalSetLambdaQuery.page(pageInfo);
|
|
|
+ page.getRecords().forEach(kfc -> {
|
|
|
+ if (StringUtil.isNotBlank(kfc.getStatus())) {
|
|
|
+ if (kfc.getStatus().equals(StatusEnum.Enable.getKey())) {
|
|
|
+ kfc.setStatus("启用");
|
|
|
+ }
|
|
|
+ if (kfc.getStatus().equals(StatusEnum.Disable.getKey())) {
|
|
|
+ kfc.setStatus("禁用");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ page.setRecords(page.getRecords());
|
|
|
return page;
|
|
|
}
|
|
|
|
|
@@ -108,7 +128,6 @@ public class HospitalSetManagementFacade {
|
|
|
* @Date: 2021/7/30
|
|
|
*/
|
|
|
public void checkHospitalSet(SaveHospitalSetVO saveHospitalSetVO) {
|
|
|
- saveHospitalSetVO.setHospitalId(SysUserUtils.getCurrentHospitalId());
|
|
|
saveHospitalSetVO.setUserId(SysUserUtils.getCurrentPrincipleId());
|
|
|
if (null == saveHospitalSetVO.getId()) {
|
|
|
Integer count = hospitalSetFacade.lambdaQuery()
|
|
@@ -157,13 +176,21 @@ public class HospitalSetManagementFacade {
|
|
|
* @Author: cy
|
|
|
* @Date: 2021/8/9
|
|
|
*/
|
|
|
- public List<String> getHospitalNames(String hospitalName) {
|
|
|
- LambdaQueryChainWrapper<HospitalSet> hospitalSetLambdaQuery = hospitalSetFacade.lambdaQuery();
|
|
|
+ public List<GetRealHospitalDTO> getHospitalNames(String hospitalName) {
|
|
|
+ List<GetRealHospitalDTO> getRealHospitalDTOS = new ArrayList<>();
|
|
|
+ LambdaQueryChainWrapper<Hospital> hospitalSetLambdaQuery = hospitalFacade.lambdaQuery();
|
|
|
if(StringUtil.isNotBlank(hospitalName)){
|
|
|
- hospitalSetLambdaQuery.like(HospitalSet::getHospitalName,hospitalName);
|
|
|
+ hospitalSetLambdaQuery.like(Hospital::getName,hospitalName);
|
|
|
}
|
|
|
- hospitalSetLambdaQuery.eq(HospitalSet::getIsDeleted, IsDeleteEnum.N.getKey());
|
|
|
- hospitalSetLambdaQuery.groupBy(HospitalSet::getHospitalName);
|
|
|
- return hospitalSetLambdaQuery.list().stream().filter(obj -> StringUtil.isNotBlank(obj.getHospitalName())).sorted(Comparator.comparing(HospitalSet::getHospitalId)).map(obj -> obj.getHospitalName()).collect(Collectors.toList());
|
|
|
+ hospitalSetLambdaQuery.eq(Hospital::getIsDeleted, IsDeleteEnum.N.getKey());
|
|
|
+ hospitalSetLambdaQuery.eq(Hospital::getType, HospitalTypeEnum.SINGLE_HOSPITAL.getKey());
|
|
|
+ List<Hospital> hspitals = hospitalSetLambdaQuery.list().stream().filter(obj -> StringUtil.isNotBlank(obj.getName())).sorted(Comparator.comparing(Hospital::getId)).collect(Collectors.toList());
|
|
|
+ hspitals.forEach(kfc->{
|
|
|
+ GetRealHospitalDTO getRealHospitalDTO = new GetRealHospitalDTO();
|
|
|
+ getRealHospitalDTO.setHospitalId(kfc.getId());
|
|
|
+ getRealHospitalDTO.setHospitalName(kfc.getName());
|
|
|
+ getRealHospitalDTOS.add(getRealHospitalDTO);
|
|
|
+ });
|
|
|
+ return getRealHospitalDTOS;
|
|
|
}
|
|
|
}
|