|
@@ -1,8 +1,17 @@
|
|
|
package com.lantone.dblayermbg.facade;
|
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.lantone.common.constant.AuthConstant;
|
|
|
+import com.lantone.common.enums.IsDeleteEnum;
|
|
|
+import com.lantone.common.service.RedisService;
|
|
|
+import com.lantone.dblayermbg.entity.HospitalSet;
|
|
|
import com.lantone.dblayermbg.service.impl.HospitalSetServiceImpl;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
+import java.util.Map;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* <p>
|
|
|
* 表名:sys_hospital_set 业务类
|
|
@@ -11,4 +20,31 @@ import org.springframework.stereotype.Component;
|
|
|
@Component
|
|
|
public class HospitalSetFacade extends HospitalSetServiceImpl {
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RedisService redisService;
|
|
|
+ @Autowired
|
|
|
+ private HospitalSetFacade hospitalSetFacade;
|
|
|
+
|
|
|
+ public Map<String, Map<String, Map<String, String>>> initHospitalSetMap() {
|
|
|
+ QueryWrapper<HospitalSet> hospitalSetQueryWrapper = new QueryWrapper<HospitalSet>()
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ Map<String, Map<String, Map<String, String>>> hospitalSetMap = hospitalSetFacade.list(hospitalSetQueryWrapper)
|
|
|
+ .stream()
|
|
|
+ .collect(
|
|
|
+ Collectors.groupingBy(
|
|
|
+ i -> i.getHospitalId().toString(),
|
|
|
+ Collectors.groupingBy(
|
|
|
+ HospitalSet::getCode,
|
|
|
+ Collectors.toMap(
|
|
|
+ HospitalSet::getName,
|
|
|
+ HospitalSet::getVal
|
|
|
+ )
|
|
|
+ )
|
|
|
+ )
|
|
|
+ );
|
|
|
+ redisService.del(AuthConstant.HOSPITAL_SET_MAP_KEY);
|
|
|
+ redisService.set(AuthConstant.HOSPITAL_SET_MAP_KEY, hospitalSetMap);
|
|
|
+ return hospitalSetMap;
|
|
|
+ }
|
|
|
+
|
|
|
}
|