Browse Source

优化接口2.0

wangfeng 6 years ago
parent
commit
590c3f64cf

+ 35 - 30
icssman-service/src/main/java/com/diagbot/facade/EvaluationModuleMappingFacade.java

@@ -102,9 +102,11 @@ public class EvaluationModuleMappingFacade extends EvaluationModuleMappingServic
 	 * @return
 	 */
 	public boolean updateEvaluationModuleList(EvaluationModuleListVO evaluationModuleListVO) {
+		boolean res = false;
+		if (evaluationModuleListVO != null && ListUtil.isNotEmpty(evaluationModuleListVO.getEvaluationModuleData())) {
 		EvaluationModuleDiseaseIdVO evaluationModuleDiseaseIdVO = new EvaluationModuleDiseaseIdVO();
 		evaluationModuleDiseaseIdVO.setDiseaseId(evaluationModuleListVO.getDiseaseId());
-		boolean res = cancelEvaluationModuleAll(evaluationModuleDiseaseIdVO);
+		res = cancelEvaluationModuleAll(evaluationModuleDiseaseIdVO);
 		List<EvaluationModuleMapping> evaluationModuleLsit = new ArrayList<EvaluationModuleMapping>();
 		List<EvaluationModuleVO> data = evaluationModuleListVO.getEvaluationModuleData();
 		for (EvaluationModuleVO dataNew : data) {
@@ -122,7 +124,7 @@ public class EvaluationModuleMappingFacade extends EvaluationModuleMappingServic
 		}
 
 		res = evaluationModuleMappingService.saveBatch(evaluationModuleLsit);
-
+		}
 		return res;
 	}
 
@@ -132,37 +134,40 @@ public class EvaluationModuleMappingFacade extends EvaluationModuleMappingServic
 	 * @return
 	 */
 	public boolean saveEvaluationModuleList(EvaluationModuleListVO evaluationModuleListVO) {
-		List<EvaluationModuleVO> evaluationData = evaluationModuleListVO.getEvaluationModuleData();
-		List<String> regionName = new ArrayList<>();
-		for (EvaluationModuleVO e : evaluationData) {
-			regionName.add(e.getRegionName());
-		}
+		boolean res = false;
+		if (evaluationModuleListVO != null && ListUtil.isNotEmpty(evaluationModuleListVO.getEvaluationModuleData())) {
+			List<EvaluationModuleVO> evaluationData = evaluationModuleListVO.getEvaluationModuleData();
+			List<String> regionName = new ArrayList<>();
+			for (EvaluationModuleVO e : evaluationData) {
+				regionName.add(e.getRegionName());
+			}
 
-		QueryWrapper<EvaluationModuleMapping> evaluationQuery = new QueryWrapper<>();
+			QueryWrapper<EvaluationModuleMapping> evaluationQuery = new QueryWrapper<>();
 
-		evaluationQuery.in("region_name", regionName).eq("is_deleted", IsDeleteEnum.N.getKey());
-		List<EvaluationModuleMapping> dataUnique = list(evaluationQuery);
-		if (dataUnique != null && dataUnique.size() > 0) {
-			throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
-					"该'" + dataUnique.get(0).getRegionName() + "'已存在");
-		}
-		List<EvaluationModuleMapping> evaluationModuleLsit = new ArrayList<EvaluationModuleMapping>();
-		List<EvaluationModuleVO> data = evaluationModuleListVO.getEvaluationModuleData();
-		for (EvaluationModuleVO dataNew : data) {
-			EvaluationModuleMapping evaMou = new EvaluationModuleMapping();
-			evaMou.setDiseaseId(dataNew.getDiseaseId());
-			evaMou.setCreator(UserUtils.getCurrentPrincipleID());
-			evaMou.setGmtCreate(DateUtil.now());
-			evaMou.setGmtModified(DateUtil.now());
-			evaMou.setRegionName(dataNew.getRegionName());
-			evaMou.setRegionType(dataNew.getRegionType());
-			evaMou.setModifier(UserUtils.getCurrentPrincipleID());
-			evaMou.setOrderNo(dataNew.getOrderNo());
-			evaMou.setRemark(dataNew.getRemark());
-			evaluationModuleLsit.add(evaMou);
+			evaluationQuery.in("region_name", regionName).eq("is_deleted", IsDeleteEnum.N.getKey());
+			List<EvaluationModuleMapping> dataUnique = list(evaluationQuery);
+			if (dataUnique != null && dataUnique.size() > 0) {
+				throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+						"该'" + dataUnique.get(0).getRegionName() + "'已存在");
+			}
+			List<EvaluationModuleMapping> evaluationModuleLsit = new ArrayList<EvaluationModuleMapping>();
+			List<EvaluationModuleVO> data = evaluationModuleListVO.getEvaluationModuleData();
+			for (EvaluationModuleVO dataNew : data) {
+				EvaluationModuleMapping evaMou = new EvaluationModuleMapping();
+				evaMou.setDiseaseId(dataNew.getDiseaseId());
+				evaMou.setCreator(UserUtils.getCurrentPrincipleID());
+				evaMou.setGmtCreate(DateUtil.now());
+				evaMou.setGmtModified(DateUtil.now());
+				evaMou.setRegionName(dataNew.getRegionName());
+				evaMou.setRegionType(dataNew.getRegionType());
+				evaMou.setModifier(UserUtils.getCurrentPrincipleID());
+				evaMou.setOrderNo(dataNew.getOrderNo());
+				evaMou.setRemark(dataNew.getRemark());
+				evaluationModuleLsit.add(evaMou);
+			}
+			res = evaluationModuleMappingService.saveBatch(evaluationModuleLsit);
 		}
-
-		return evaluationModuleMappingService.saveBatch(evaluationModuleLsit);
+		return res;
 	}
 
 	/**

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

@@ -25,6 +25,7 @@ import com.diagbot.service.IndexConfigService;
 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.UserUtils;
 import com.diagbot.vo.IndexConfigDiseaseIdVO;
 import com.diagbot.vo.IndexConfigDiseaseNameVO;
@@ -96,71 +97,78 @@ public class IndexConfigFacade extends IndexConfigServiceImpl {
 	 * @return
 	 */
 	public boolean updateIndexConfigList(IndexConfigListVO indexConfigListVO) {
-		
-		/*UpdateWrapper<IndexConfig> IndexConfigNew =new UpdateWrapper<>();
-		IndexConfigNew.eq("disease_id",indexConfigListVO.getDiseaseId()).eq("is_deleted", IsDeleteEnum.N.getKey())
-		.set("is_deleted", IsDeleteEnum.Y.getKey()).set("modifier", UserUtils.getCurrentPrincipleID())
-        .set("gmt_modified", DateUtil.now());
-		boolean res = update(new IndexConfig(), IndexConfigNew);*/
-		IndexConfigDiseaseIdVO indexConfigDiseaseIdVO =new IndexConfigDiseaseIdVO();
-		indexConfigDiseaseIdVO.setDiseaseId(indexConfigListVO.getDiseaseId());
-		boolean res =  cancelIndexConfigAlls(indexConfigDiseaseIdVO);
-		List<IndexConfig> IndexConfigLsit= new ArrayList<IndexConfig>();
-		List<IndexConfigVO> data = indexConfigListVO.getIndexConfigData();
-		for(IndexConfigVO dataNew : data){
-			IndexConfig IndexConfig= new IndexConfig();
-			IndexConfig.setDiseaseId(dataNew.getDiseaseId());
-			IndexConfig.setCreator(UserUtils.getCurrentPrincipleID());
-			IndexConfig.setGmtCreate(DateUtil.now());
-			IndexConfig.setGmtModified(DateUtil.now());
-			IndexConfig.setIndexDesc(dataNew.getIndexDesc());
-			IndexConfig.setIndexUnique(dataNew.getIndexUnique());
-			IndexConfig.setModifier(UserUtils.getCurrentPrincipleID());
-			IndexConfig.setOrderNo(dataNew.getOrderNo());
-			IndexConfig.setRemark(dataNew.getRemark());
-			IndexConfigLsit.add(IndexConfig);
+		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();
+				IndexConfig.setDiseaseId(dataNew.getDiseaseId());
+				IndexConfig.setCreator(UserUtils.getCurrentPrincipleID());
+				IndexConfig.setGmtCreate(DateUtil.now());
+				IndexConfig.setGmtModified(DateUtil.now());
+				IndexConfig.setIndexDesc(dataNew.getIndexDesc());
+				IndexConfig.setIndexUnique(dataNew.getIndexUnique());
+				IndexConfig.setModifier(UserUtils.getCurrentPrincipleID());
+				IndexConfig.setOrderNo(dataNew.getOrderNo());
+				IndexConfig.setRemark(dataNew.getRemark());
+				IndexConfigLsit.add(IndexConfig);
+			}
+
+			res = indexConfigService.saveBatch(IndexConfigLsit);
+
 		}
-		
-		res = indexConfigService.saveBatch(IndexConfigLsit);
-		
+
 		return res;
 	}
 	
+	/**
+	 * 
+	 * @param indexConfigListVO
+	 * @return
+	 */
 	public boolean saveIndexConfigList(IndexConfigListVO indexConfigListVO) {
-		List<IndexConfigVO> indexConfigData = indexConfigListVO.getIndexConfigData();
-		List<String> indexUnique = new ArrayList<>();
-		for(IndexConfigVO e: indexConfigData){
-			indexUnique.add(e.getIndexUnique());
-		}
-		
-        QueryWrapper<IndexConfig> IndexConfigQuery = new QueryWrapper<>();
+		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.in("index_unique", indexUnique);
+			List<IndexConfig> dataUnique = list(IndexConfigQuery);
+			if (dataUnique != null && dataUnique.size() > 0) {
+				throw new CommonException(CommonErrorCode.SERVER_IS_ERROR,
+						"该'" + dataUnique.get(0).getIndexUnique() + "'已存在");
+			}
 
-        IndexConfigQuery.in("index_unique", indexUnique);
-        List<IndexConfig> dataUnique = list(IndexConfigQuery);
-        if(dataUnique != null && dataUnique.size()>0){
-        	 throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "该'"+dataUnique.get(0).getIndexUnique()+"'已存在");	       	
-        }
-        
-        List<IndexConfig> IndexConfigLsit= new ArrayList<IndexConfig>();
-		List<IndexConfigVO> data = indexConfigListVO.getIndexConfigData();
-		for(IndexConfigVO dataNew : data){
-			IndexConfig IndexConfig= new IndexConfig();
-			IndexConfig.setDiseaseId(dataNew.getDiseaseId());
-			IndexConfig.setCreator(UserUtils.getCurrentPrincipleID());
-			IndexConfig.setGmtCreate(DateUtil.now());
-			IndexConfig.setGmtModified(DateUtil.now());
-			IndexConfig.setIndexDesc(dataNew.getIndexDesc());
-			IndexConfig.setIndexUnique(dataNew.getIndexUnique());
-			IndexConfig.setModifier(UserUtils.getCurrentPrincipleID());
-			IndexConfig.setOrderNo(dataNew.getOrderNo());
-			IndexConfig.setRemark(dataNew.getRemark());
-			IndexConfigLsit.add(IndexConfig);
+			List<IndexConfig> IndexConfigLsit = new ArrayList<IndexConfig>();
+			List<IndexConfigVO> data = indexConfigListVO.getIndexConfigData();
+			for (IndexConfigVO dataNew : data) {
+				IndexConfig IndexConfig = new IndexConfig();
+				IndexConfig.setDiseaseId(dataNew.getDiseaseId());
+				IndexConfig.setCreator(UserUtils.getCurrentPrincipleID());
+				IndexConfig.setGmtCreate(DateUtil.now());
+				IndexConfig.setGmtModified(DateUtil.now());
+				IndexConfig.setIndexDesc(dataNew.getIndexDesc());
+				IndexConfig.setIndexUnique(dataNew.getIndexUnique());
+				IndexConfig.setModifier(UserUtils.getCurrentPrincipleID());
+				IndexConfig.setOrderNo(dataNew.getOrderNo());
+				IndexConfig.setRemark(dataNew.getRemark());
+				IndexConfigLsit.add(IndexConfig);
+			}
+			res = indexConfigService.saveBatch(IndexConfigLsit);
 		}
-		
-		return indexConfigService.saveBatch(IndexConfigLsit);
+
+		return res;
 	}
 	
-	
 	/**
 	 * 
 	 * @param indexConfigDiseaseIdVO

+ 3 - 0
icssman-service/src/main/java/com/diagbot/vo/EvaluationModuleDiseaseIdVO.java

@@ -1,5 +1,7 @@
 package com.diagbot.vo;
 
+import javax.validation.constraints.NotNull;
+
 import lombok.Getter;
 import lombok.Setter;
 
@@ -15,5 +17,6 @@ public class EvaluationModuleDiseaseIdVO {
 	/**
 	 * 疾病ID
 	 */
+	@NotNull(message = "请输入疾病id")
 	private Long diseaseId;
 }

+ 3 - 0
icssman-service/src/main/java/com/diagbot/vo/EvaluationModuleListVO.java

@@ -2,6 +2,8 @@ package com.diagbot.vo;
 
 import java.util.List;
 
+import javax.validation.constraints.NotNull;
+
 import lombok.Getter;
 import lombok.Setter;
 
@@ -15,6 +17,7 @@ import lombok.Setter;
 @Getter
 public class EvaluationModuleListVO {
 
+	@NotNull(message = "请输入疾病id")
 	private Long diseaseId;
 	
 	private List<EvaluationModuleVO> evaluationModuleData;

+ 3 - 0
icssman-service/src/main/java/com/diagbot/vo/IndexConfigDiseaseIdVO.java

@@ -1,5 +1,7 @@
 package com.diagbot.vo;
 
+import javax.validation.constraints.NotNull;
+
 import lombok.Getter;
 import lombok.Setter;
 
@@ -15,5 +17,6 @@ public class IndexConfigDiseaseIdVO {
 	/**
 	 * 疾病ID
 	 */
+	@NotNull(message = "请输入疾病id")
 	private Long diseaseId; 
 }

+ 4 - 1
icssman-service/src/main/java/com/diagbot/vo/IndexConfigListVO.java

@@ -2,6 +2,8 @@ package com.diagbot.vo;
 
 import java.util.List;
 
+import javax.validation.constraints.NotNull;
+
 import lombok.Getter;
 import lombok.Setter;
 
@@ -14,7 +16,8 @@ import lombok.Setter;
 @Setter
 @Getter
 public class IndexConfigListVO {
-
+	
+	@NotNull(message = "请输入疾病id")
 	private Long diseaseId;
 	
 	private List<IndexConfigVO> indexConfigData;

+ 44 - 42
icssman-service/src/main/java/com/diagbot/web/IndexConfigController.java

@@ -1,6 +1,5 @@
 package com.diagbot.web;
 
-
 import java.util.List;
 
 import org.springframework.beans.factory.annotation.Autowired;
@@ -33,63 +32,66 @@ import io.swagger.annotations.ApiOperation;
 @RestController
 @RequestMapping("/indexConfig")
 @Api(value = "慢病指标值关联维护API[by:wangfeng]", tags = { "WF-2期-慢病指标值关联维护API" })
-@SuppressWarnings("unchecked") 
+@SuppressWarnings("unchecked")
 public class IndexConfigController {
-	
+
 	@Autowired
 	IndexConfigFacade indexConfigFacade;
-	
-	@ApiOperation(value = "分页模糊查询慢病指标值关联维护[by:wangfeng]", notes = "")
-    @PostMapping("/queryIndexConfigPages")
-    @SysLogger("queryIndexConfigPages")
-    @Transactional
-    public RespDTO<IPage<IndexConfigDTO>> queryIndexConfigPages(@RequestBody IndexConfigDiseaseNameVO indexConfigDiseaseNameVO) {
 
-    	IPage<IndexConfigDTO> data = indexConfigFacade.queryIndexConfigPage(indexConfigDiseaseNameVO);
+	@ApiOperation(value = "分页模糊查询慢病指标值关联维护[by:wangfeng]", notes = "diseaseName:慢病名字")
+	@PostMapping("/queryIndexConfigPages")
+	@SysLogger("queryIndexConfigPages")
+	@Transactional
+	public RespDTO<IPage<IndexConfigDTO>> queryIndexConfigPages(
+			@RequestBody IndexConfigDiseaseNameVO indexConfigDiseaseNameVO) {
+
+		IPage<IndexConfigDTO> data = indexConfigFacade.queryIndexConfigPage(indexConfigDiseaseNameVO);
 
-        return RespDTO.onSuc(data);
-    }
+		return RespDTO.onSuc(data);
+	}
 
-	@ApiOperation(value = "获取慢病指标值关联维护[by:wangfeng]", notes = "")
-    @PostMapping("/getIndexConfigLists")
-    @SysLogger("getIndexConfigLists")
-    @Transactional
-    public RespDTO<List<IndexConfigAllDTO>> getIndexConfigLists(@RequestBody IndexConfigDiseaseIdVO indexConfigDiseaseIdVO) {
+	@ApiOperation(value = "获取慢病指标值关联维护[by:wangfeng]", notes = "diseaseId : 慢病id")
+	@PostMapping("/getIndexConfigLists")
+	@SysLogger("getIndexConfigLists")
+	@Transactional
+	public RespDTO<List<IndexConfigAllDTO>> getIndexConfigLists(
+			@RequestBody IndexConfigDiseaseIdVO indexConfigDiseaseIdVO) {
 
 		List<IndexConfigAllDTO> data = indexConfigFacade.getIndexConfigLists(indexConfigDiseaseIdVO);
 
-        return RespDTO.onSuc(data);
-    }
-	
-	@ApiOperation(value = "慢病指标值关联维护——修改关联[by:wangfeng]", notes = "")
-    @PostMapping("/updateIndexConfigList")
-    @SysLogger("updateIndexConfigList")
-    @Transactional
-    public RespDTO<Boolean> updateIndexConfigList(@RequestBody IndexConfigListVO indexConfigListVO) {
+		return RespDTO.onSuc(data);
+	}
+
+	@ApiOperation(value = "慢病指标值关联维护——修改关联[by:wangfeng]", notes = "指标公表名+indexUnique; 疾病id+diseaseId;指标描述+indexDesc; 显示顺序+ orderNo; 备注+remark;")
+	@PostMapping("/updateIndexConfigList")
+	@SysLogger("updateIndexConfigList")
+	@Transactional
+	public RespDTO<Boolean> updateIndexConfigList(@RequestBody IndexConfigListVO indexConfigListVO) {
 
 		boolean res = indexConfigFacade.updateIndexConfigList(indexConfigListVO);
 
-        return RespDTO.onSuc(res);
-    }
-	@ApiOperation(value = "慢病指标值关联维护——添加关联[by:wangfeng]", notes = "")
-    @PostMapping("/saveIndexConfigLists")
-    @SysLogger("saveIndexConfigLists")
-    @Transactional
-    public RespDTO<Boolean> saveIndexConfigLists(@RequestBody IndexConfigListVO indexConfigListVO) {
+		return RespDTO.onSuc(res);
+	}
+
+	@ApiOperation(value = "慢病指标值关联维护——添加关联[by:wangfeng]", notes = "指标公表名+indexUnique; 疾病id+diseaseId;指标描述+indexDesc; 显示顺序+ orderNo; 备注+remark;")
+	@PostMapping("/saveIndexConfigLists")
+	@SysLogger("saveIndexConfigLists")
+	@Transactional
+	public RespDTO<Boolean> saveIndexConfigLists(@RequestBody IndexConfigListVO indexConfigListVO) {
 
 		boolean res = indexConfigFacade.saveIndexConfigList(indexConfigListVO);
 
-        return RespDTO.onSuc(res);
-    }
-	
-	@ApiOperation(value = "删除慢病指标值关联维护[by:wangfeng]", notes = "")
-    @PostMapping("/cancelIndexConfigAlls")
-    @SysLogger("cancelIndexConfigAlls")
-    @Transactional
-    public RespDTO<Boolean> cancelIndexConfigAlls(@RequestBody IndexConfigDiseaseIdVO indexConfigDiseaseIdVO) {
+		return RespDTO.onSuc(res);
+	}
+
+	@ApiOperation(value = "删除慢病指标值关联维护[by:wangfeng]", notes = "请输入疾病  id :diseaseId;")
+	@PostMapping("/cancelIndexConfigAlls")
+	@SysLogger("cancelIndexConfigAlls")
+	@Transactional
+	public RespDTO<Boolean> cancelIndexConfigAlls(@RequestBody IndexConfigDiseaseIdVO indexConfigDiseaseIdVO) {
 
 		boolean res = indexConfigFacade.cancelIndexConfigAlls(indexConfigDiseaseIdVO);
 
-        return RespDTO.onSuc(res);
-    }
+		return RespDTO.onSuc(res);
+	}
 }