Kaynağa Gözat

慢病指标管理问题解决

gaodm 6 yıl önce
ebeveyn
işleme
473ea454ea

+ 24 - 24
icssman-service/src/main/java/com/diagbot/facade/IndexConfigFacade.java

@@ -1,18 +1,8 @@
 package com.diagbot.facade;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
 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.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.diagbot.client.UserServiceClient;
 import com.diagbot.dto.DiseaseInfoDTO;
 import com.diagbot.dto.IndexConfigAllDTO;
@@ -27,12 +17,22 @@ import com.diagbot.service.impl.IndexConfigServiceImpl;
 import com.diagbot.util.BeanUtil;
 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;
 import com.diagbot.vo.IndexConfigVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * @author wangfeng
@@ -43,24 +43,24 @@ import com.diagbot.vo.IndexConfigVO;
 public class IndexConfigFacade extends IndexConfigServiceImpl {
 
 	@Autowired
+	@Qualifier("indexConfigServiceImpl")
 	IndexConfigService indexConfigService;
 	@Autowired
 	UserServiceClient userServiceClient;
 	/**
-	 * 
-	 * @param page
+	 *
 	 * @param indexConfigDiseaseNameVO
 	 * @return
 	 */
 	public IPage<IndexConfigDTO> queryIndexConfigPage(IndexConfigDiseaseNameVO indexConfigDiseaseNameVO) {
-		IPage<IndexConfigDTO> datas = indexConfigService.queryIndexConfigPageAlls(indexConfigDiseaseNameVO);
+		IPage<IndexConfigDTO> datas = this.queryIndexConfigPageAlls(indexConfigDiseaseNameVO);
 		List<IndexConfigDTO> data = datas.getRecords();
 		List<String> modifierid = new ArrayList<>();
 		modifierid = data.stream().map(ac -> ac.getModifier()).collect(Collectors.toList());
 		Map<String, String> userNames = new HashMap<>();
 		if (modifierid.size() > 0) {
 			RespDTO<Map<String, String>> userNamesDTO = userServiceClient.getUserInfoByIds(modifierid);
-			if (userNamesDTO == null || !CommonErrorCode.OK.getCode().equals(userNamesDTO.code)) {
+			if (RespDTOUtil.respIsNG(userNamesDTO)) {
 				throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "获取所有用户信息失败");
 			}
 			userNames = userNamesDTO.data;
@@ -68,17 +68,14 @@ public class IndexConfigFacade extends IndexConfigServiceImpl {
 		List<IndexConfigDTO> indexConfigLists = new ArrayList<IndexConfigDTO>();
 		for (IndexConfigDTO evalua : data) {
 			IndexConfigDTO dateNew = new IndexConfigDTO();
-			dateNew.setId(evalua.getId());
-			dateNew.setCreator(evalua.getCreator());
-			dateNew.setGmtModified(evalua.getGmtModified());
-			dateNew.setDiseaseId(evalua.getDiseaseId());
-			dateNew.setGmtCreate(evalua.getGmtCreate());
+			BeanUtil.copyProperties(evalua,dateNew);
 			dateNew.setModifier(userNames.get(evalua.getModifier()));
-			dateNew.setDiseaseName(evalua.getDiseaseName());
 			indexConfigLists.add(dateNew);
 		}
 
-		return datas.setRecords(indexConfigLists);
+		datas.setRecords(indexConfigLists);
+
+		return datas;
 	}
 	/**
 	 * 
@@ -134,7 +131,8 @@ public class IndexConfigFacade extends IndexConfigServiceImpl {
 	 */
 	public boolean saveIndexConfigList(IndexConfigListVO indexConfigListVO) {
 		boolean res = false;
-		if (indexConfigListVO != null && ListUtil.isNotEmpty(indexConfigListVO.getIndexConfigData())) {
+		if (indexConfigListVO != null
+				&& ListUtil.isNotEmpty(indexConfigListVO.getIndexConfigData())) {
 			List<IndexConfigVO> indexConfigData = indexConfigListVO.getIndexConfigData();
 			List<String> indexUnique = new ArrayList<>();
 			for (IndexConfigVO e : indexConfigData) {
@@ -143,9 +141,11 @@ public class IndexConfigFacade extends IndexConfigServiceImpl {
 
 			QueryWrapper<IndexConfig> IndexConfigQuery = new QueryWrapper<>();
 
-			IndexConfigQuery.in("index_unique", indexUnique);
+			IndexConfigQuery.eq("disease_id",indexConfigListVO.getDiseaseId())
+					.eq("is_deleted",IsDeleteEnum.N.getKey())
+					.in("index_unique", indexUnique);
 			List<IndexConfig> dataUnique = list(IndexConfigQuery);
-			if (dataUnique != null && dataUnique.size() > 0) {
+			if (ListUtil.isNotEmpty(dataUnique)) {
 				throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
 						"该'" + dataUnique.get(0).getIndexUnique() + "'已存在");
 			}

+ 8 - 6
icssman-service/src/main/resources/mapper/IndexConfigMapper.xml

@@ -29,25 +29,27 @@
 	icss_index_config a
 	JOIN icss_question_info b
 	WHERE a.disease_id = b.id
-	<if test="indexConfigVO.diseaseName != null">
+	AND a.is_deleted = "N"
+	AND b.is_deleted = "N"
+	<if test="indexConfigVO.diseaseName != null and indexConfigVO.diseaseName != ''">
 	AND b.tag_name LIKE CONCAT('%', #{indexConfigVO.diseaseName}, '%')
 	</if>
 	GROUP BY a.disease_id
 	ORDER BY a.gmt_create DESC
 </select>
 <select id="queryIndexConfigDiseaseName" resultType="com.diagbot.dto.DiseaseInfoDTO">
-	SELECT
+	SELECT DISTINCT
 	a.dis_id AS diseaseId,
 	b.tag_name AS diseaseName
 	FROM
 	icss_dis_type a
-	LEFT JOIN icss_index_config c
-	ON a.dis_id = c.disease_id
 	JOIN icss_question_info b
 	ON a.dis_id = b.id
-	WHERE c.disease_id IS NULL
+	WHERE a.type = 1
+	AND a.dis_id not in (SELECT DISTINCT f.disease_id as diseaseId From icss_index_config f WHERE f.is_deleted ="N")
 	AND a.is_deleted = "N"
-	<if test="diseaseNameVO.diseaseName != null">
+	AND b.is_deleted = "N"
+	<if test="diseaseNameVO.diseaseName != null and diseaseNameVO.diseaseName != ''">
 	AND b.tag_name LIKE CONCAT('%', #{diseaseNameVO.diseaseName}, '%')
 	</if>
 	ORDER BY b.tag_name DESC