|
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.diagbot.client.UserServiceClient;
|
|
|
-import com.diagbot.dto.DiseaseInfoDTO;
|
|
|
import com.diagbot.dto.IndexConfigAllDTO;
|
|
|
import com.diagbot.dto.IndexConfigDTO;
|
|
|
import com.diagbot.dto.RespDTO;
|
|
@@ -19,7 +18,6 @@ import com.diagbot.util.DateUtil;
|
|
|
import com.diagbot.util.ListUtil;
|
|
|
import com.diagbot.util.RespDTOUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
-import com.diagbot.vo.DiseaseNameVO;
|
|
|
import com.diagbot.vo.IndexConfigDiseaseIdVO;
|
|
|
import com.diagbot.vo.IndexConfigDiseaseNameVO;
|
|
|
import com.diagbot.vo.IndexConfigListVO;
|
|
@@ -29,6 +27,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -42,140 +41,138 @@ import java.util.stream.Collectors;
|
|
|
@Component
|
|
|
public class IndexConfigFacade extends IndexConfigServiceImpl {
|
|
|
|
|
|
- @Autowired
|
|
|
- @Qualifier("indexConfigServiceImpl")
|
|
|
- IndexConfigService indexConfigService;
|
|
|
- @Autowired
|
|
|
- UserServiceClient userServiceClient;
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param indexConfigDiseaseNameVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public IPage<IndexConfigDTO> queryIndexConfigPage(IndexConfigDiseaseNameVO indexConfigDiseaseNameVO) {
|
|
|
- IPage<IndexConfigDTO> datas = this.queryIndexConfigPageAlls(indexConfigDiseaseNameVO);
|
|
|
- List<IndexConfigDTO> data = datas.getRecords();
|
|
|
- List<String> modifierid
|
|
|
- = data.stream().map(ac -> ac.getModifier()).collect(Collectors.toList());
|
|
|
- Map<String, String> userNames = new HashMap<>();
|
|
|
- if (ListUtil.isNotEmpty(modifierid)) {
|
|
|
- RespDTO<Map<String, String>> userNamesDTO = userServiceClient.getUserInfoByIds(modifierid);
|
|
|
- if (RespDTOUtil.respIsNG(userNamesDTO)) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取所有用户信息失败");
|
|
|
- }
|
|
|
- userNames = userNamesDTO.data;
|
|
|
- }
|
|
|
-
|
|
|
- for (IndexConfigDTO evalua : data) {
|
|
|
- evalua.setModifier(userNames.get(evalua.getModifier()));
|
|
|
- }
|
|
|
- return datas;
|
|
|
- }
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param indexConfigDiseaseIdVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public List<IndexConfigAllDTO> getIndexConfigLists(IndexConfigDiseaseIdVO indexConfigDiseaseIdVO) {
|
|
|
- QueryWrapper<IndexConfig> IndexConfigQuery = new QueryWrapper<IndexConfig>();
|
|
|
- IndexConfigQuery.eq("disease_id",indexConfigDiseaseIdVO.getDiseaseId()).eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
- List<IndexConfig> datas = list(IndexConfigQuery);
|
|
|
+ @Autowired
|
|
|
+ @Qualifier("indexConfigServiceImpl")
|
|
|
+ IndexConfigService indexConfigService;
|
|
|
+ @Autowired
|
|
|
+ UserServiceClient userServiceClient;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param indexConfigDiseaseNameVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public IPage<IndexConfigDTO> queryIndexConfigPage(IndexConfigDiseaseNameVO indexConfigDiseaseNameVO) {
|
|
|
+ IPage<IndexConfigDTO> datas = this.queryIndexConfigPageAlls(indexConfigDiseaseNameVO);
|
|
|
+ List<IndexConfigDTO> data = datas.getRecords();
|
|
|
+ List<String> modifierid
|
|
|
+ = data.stream().map(ac -> ac.getModifier()).collect(Collectors.toList());
|
|
|
+ Map<String, String> userNames = new HashMap<>();
|
|
|
+ if (ListUtil.isNotEmpty(modifierid)) {
|
|
|
+ RespDTO<Map<String, String>> userNamesDTO = userServiceClient.getUserInfoByIds(modifierid);
|
|
|
+ if (RespDTOUtil.respIsNG(userNamesDTO)) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取所有用户信息失败");
|
|
|
+ }
|
|
|
+ userNames = userNamesDTO.data;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (IndexConfigDTO evalua : data) {
|
|
|
+ evalua.setModifier(userNames.get(evalua.getModifier()));
|
|
|
+ }
|
|
|
+ return datas;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param indexConfigDiseaseIdVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public List<IndexConfigAllDTO> getIndexConfigLists(IndexConfigDiseaseIdVO indexConfigDiseaseIdVO) {
|
|
|
+ QueryWrapper<IndexConfig> IndexConfigQuery = new QueryWrapper<IndexConfig>();
|
|
|
+ IndexConfigQuery.eq("disease_id", indexConfigDiseaseIdVO.getDiseaseId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
+ List<IndexConfig> datas = list(IndexConfigQuery);
|
|
|
//过滤
|
|
|
List<IndexConfigAllDTO> data = BeanUtil.listCopyTo(datas, IndexConfigAllDTO.class);
|
|
|
- return data;
|
|
|
- }
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param indexConfigListVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public boolean updateIndexConfigList(IndexConfigListVO indexConfigListVO) {
|
|
|
- boolean res = false;
|
|
|
- if (indexConfigListVO != null && ListUtil.isNotEmpty(indexConfigListVO.getIndexConfigData())) {
|
|
|
- IndexConfigDiseaseIdVO indexConfigDiseaseIdVO = new IndexConfigDiseaseIdVO();
|
|
|
- indexConfigDiseaseIdVO.setDiseaseId(indexConfigListVO.getDiseaseId());
|
|
|
- res = cancelIndexConfigAlls(indexConfigDiseaseIdVO);
|
|
|
- List<IndexConfig> IndexConfigLsit = new ArrayList<IndexConfig>();
|
|
|
- List<IndexConfigVO> data = indexConfigListVO.getIndexConfigData();
|
|
|
- for (IndexConfigVO dataNew : data) {
|
|
|
- IndexConfig IndexConfig = new IndexConfig();
|
|
|
- BeanUtil.copyProperties(dataNew,IndexConfig);
|
|
|
- IndexConfig.setGmtCreate(DateUtil.now());
|
|
|
- IndexConfig.setGmtModified(DateUtil.now());
|
|
|
- IndexConfig.setCreator(UserUtils.getCurrentPrincipleID());
|
|
|
- IndexConfig.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
- IndexConfigLsit.add(IndexConfig);
|
|
|
- }
|
|
|
-
|
|
|
- res = indexConfigService.saveBatch(IndexConfigLsit);
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param indexConfigListVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public boolean saveIndexConfigList(IndexConfigListVO indexConfigListVO) {
|
|
|
- boolean res = false;
|
|
|
- if (indexConfigListVO != null
|
|
|
- && ListUtil.isNotEmpty(indexConfigListVO.getIndexConfigData())) {
|
|
|
- List<IndexConfigVO> indexConfigData = indexConfigListVO.getIndexConfigData();
|
|
|
- List<String> indexUnique = new ArrayList<>();
|
|
|
- for (IndexConfigVO e : indexConfigData) {
|
|
|
- indexUnique.add(e.getIndexUnique());
|
|
|
- }
|
|
|
-
|
|
|
- QueryWrapper<IndexConfig> IndexConfigQuery = new QueryWrapper<>();
|
|
|
-
|
|
|
- IndexConfigQuery.eq("disease_id",indexConfigListVO.getDiseaseId())
|
|
|
- .eq("is_deleted",IsDeleteEnum.N.getKey())
|
|
|
- .in("index_unique", indexUnique);
|
|
|
- List<IndexConfig> dataUnique = list(IndexConfigQuery);
|
|
|
- if (ListUtil.isNotEmpty(dataUnique)) {
|
|
|
- throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
- "该'" + dataUnique.get(0).getConceptId() + "'已存在");
|
|
|
- }
|
|
|
-
|
|
|
- List<IndexConfig> IndexConfigLsit = new ArrayList<IndexConfig>();
|
|
|
- List<IndexConfigVO> data = indexConfigListVO.getIndexConfigData();
|
|
|
- for (IndexConfigVO dataNew : data) {
|
|
|
- IndexConfig IndexConfig = new IndexConfig();
|
|
|
- BeanUtil.copyProperties(dataNew,IndexConfig);
|
|
|
- IndexConfig.setGmtCreate(DateUtil.now());
|
|
|
- IndexConfig.setGmtModified(DateUtil.now());
|
|
|
- IndexConfig.setCreator(UserUtils.getCurrentPrincipleID());
|
|
|
- IndexConfig.setModifier(UserUtils.getCurrentPrincipleID());
|
|
|
- IndexConfigLsit.add(IndexConfig);
|
|
|
- }
|
|
|
- res = indexConfigService.saveBatch(IndexConfigLsit);
|
|
|
- }
|
|
|
-
|
|
|
- return res;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param indexConfigDiseaseIdVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public boolean cancelIndexConfigAlls(IndexConfigDiseaseIdVO indexConfigDiseaseIdVO) {
|
|
|
-
|
|
|
- UpdateWrapper<IndexConfig> IndexConfigNew =new UpdateWrapper<>();
|
|
|
- IndexConfigNew.eq("disease_id",indexConfigDiseaseIdVO.getDiseaseId()).eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
- .set("is_deleted", IsDeleteEnum.Y.getKey()).set("modifier", UserUtils.getCurrentPrincipleID())
|
|
|
- .set("gmt_modified", DateUtil.now());
|
|
|
- return update(new IndexConfig(), IndexConfigNew);
|
|
|
- }
|
|
|
- /**
|
|
|
- *
|
|
|
- * @param diseaseNameVO
|
|
|
- * @return
|
|
|
- */
|
|
|
- public List<DiseaseInfoDTO> queryIndexConfigDiseaseName(DiseaseNameVO diseaseNameVO) {
|
|
|
- return indexConfigService.queryIndexConfigDiseaseName(diseaseNameVO);
|
|
|
- }
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param indexConfigListVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean updateIndexConfigList(IndexConfigListVO indexConfigListVO) {
|
|
|
+ boolean res = false;
|
|
|
+ if (indexConfigListVO != null && ListUtil.isNotEmpty(indexConfigListVO.getIndexConfigData())) {
|
|
|
+ IndexConfigDiseaseIdVO indexConfigDiseaseIdVO = new IndexConfigDiseaseIdVO();
|
|
|
+ indexConfigDiseaseIdVO.setDiseaseId(indexConfigListVO.getDiseaseId());
|
|
|
+ res = cancelIndexConfigAlls(indexConfigDiseaseIdVO);
|
|
|
+ List<IndexConfig> IndexConfigLsit = new ArrayList<IndexConfig>();
|
|
|
+ List<IndexConfigVO> data = indexConfigListVO.getIndexConfigData();
|
|
|
+ Date optDate = DateUtil.now();
|
|
|
+ String operator = UserUtils.getCurrentPrincipleID();
|
|
|
+ for (IndexConfigVO dataNew : data) {
|
|
|
+ IndexConfig IndexConfig = new IndexConfig();
|
|
|
+ BeanUtil.copyProperties(dataNew, IndexConfig);
|
|
|
+ IndexConfig.setGmtCreate(optDate);
|
|
|
+ IndexConfig.setGmtModified(optDate);
|
|
|
+ IndexConfig.setCreator(operator);
|
|
|
+ IndexConfig.setModifier(operator);
|
|
|
+ IndexConfigLsit.add(IndexConfig);
|
|
|
+ }
|
|
|
+
|
|
|
+ res = indexConfigService.saveBatch(IndexConfigLsit);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param indexConfigListVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean saveIndexConfigList(IndexConfigListVO indexConfigListVO) {
|
|
|
+ boolean res = false;
|
|
|
+ if (indexConfigListVO != null
|
|
|
+ && ListUtil.isNotEmpty(indexConfigListVO.getIndexConfigData())) {
|
|
|
+ List<IndexConfigVO> indexConfigData = indexConfigListVO.getIndexConfigData();
|
|
|
+ List<String> indexUnique = new ArrayList<>();
|
|
|
+ for (IndexConfigVO e : indexConfigData) {
|
|
|
+ indexUnique.add(e.getIndexUnique());
|
|
|
+ }
|
|
|
+
|
|
|
+ QueryWrapper<IndexConfig> IndexConfigQuery = new QueryWrapper<>();
|
|
|
+
|
|
|
+ IndexConfigQuery.eq("disease_id", indexConfigListVO.getDiseaseId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("index_unique", indexUnique);
|
|
|
+ List<IndexConfig> dataUnique = list(IndexConfigQuery);
|
|
|
+ if (ListUtil.isNotEmpty(dataUnique)) {
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
|
|
|
+ "该'" + dataUnique.get(0).getConceptId() + "'已存在");
|
|
|
+ }
|
|
|
+
|
|
|
+ List<IndexConfig> IndexConfigLsit = new ArrayList<IndexConfig>();
|
|
|
+ List<IndexConfigVO> data = indexConfigListVO.getIndexConfigData();
|
|
|
+ Date optDate = DateUtil.now();
|
|
|
+ String operator = UserUtils.getCurrentPrincipleID();
|
|
|
+ for (IndexConfigVO dataNew : data) {
|
|
|
+ IndexConfig IndexConfig = new IndexConfig();
|
|
|
+ BeanUtil.copyProperties(dataNew, IndexConfig);
|
|
|
+ IndexConfig.setGmtCreate(optDate);
|
|
|
+ IndexConfig.setGmtModified(optDate);
|
|
|
+ IndexConfig.setCreator(operator);
|
|
|
+ IndexConfig.setModifier(operator);
|
|
|
+ IndexConfigLsit.add(IndexConfig);
|
|
|
+ }
|
|
|
+ res = indexConfigService.saveBatch(IndexConfigLsit);
|
|
|
+ }
|
|
|
+
|
|
|
+ return res;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param indexConfigDiseaseIdVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean cancelIndexConfigAlls(IndexConfigDiseaseIdVO indexConfigDiseaseIdVO) {
|
|
|
+
|
|
|
+ UpdateWrapper<IndexConfig> IndexConfigNew = new UpdateWrapper<>();
|
|
|
+ IndexConfigNew.eq("disease_id", indexConfigDiseaseIdVO.getDiseaseId())
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .set("is_deleted", IsDeleteEnum.Y.getKey())
|
|
|
+ .set("modifier", UserUtils.getCurrentPrincipleID())
|
|
|
+ .set("gmt_modified", DateUtil.now());
|
|
|
+ return update(new IndexConfig(), IndexConfigNew);
|
|
|
+ }
|
|
|
+
|
|
|
}
|