|
@@ -15,6 +15,7 @@ import com.diagbot.service.DisScaleService;
|
|
|
import com.diagbot.service.impl.DisScaleServiceImpl;
|
|
|
import com.diagbot.util.BeanUtil;
|
|
|
import com.diagbot.util.DateUtil;
|
|
|
+import com.diagbot.util.RespDTOUtil;
|
|
|
import com.diagbot.util.UserUtils;
|
|
|
import com.diagbot.vo.AddDisScaleInfoVO;
|
|
|
import com.diagbot.vo.GetDisScaleAllInfoVO;
|
|
@@ -34,7 +35,7 @@ import java.util.stream.Collectors;
|
|
|
* @time: 2019/4/1 13:29
|
|
|
*/
|
|
|
@Component
|
|
|
-public class DisScaleFacade extends DisScaleServiceImpl{
|
|
|
+public class DisScaleFacade extends DisScaleServiceImpl {
|
|
|
@Autowired
|
|
|
private QuestionFacade questionFacade;
|
|
|
@Autowired
|
|
@@ -53,16 +54,16 @@ public class DisScaleFacade extends DisScaleServiceImpl{
|
|
|
String userId = UserUtils.getCurrentPrincipleID();
|
|
|
//判断诊断是否已被删除
|
|
|
QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- questionInfoQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
|
|
|
- .eq("id",addDisScaleInfoVO.getDisId());
|
|
|
- if(questionFacade.count(questionInfoQueryWrapper) == 0){
|
|
|
+ questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("id", addDisScaleInfoVO.getDisId());
|
|
|
+ if (questionFacade.count(questionInfoQueryWrapper) == 0) {
|
|
|
throw new CommonException(CommonErrorCode.NOT_EXISTS,
|
|
|
"关联诊断标签已删除");
|
|
|
}
|
|
|
//判断该诊断是否关联过量表
|
|
|
QueryWrapper<DisScale> disScaleQueryWrapper = new QueryWrapper<>();
|
|
|
- disScaleQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
|
|
|
- .eq("dis_id",addDisScaleInfoVO.getDisId());
|
|
|
+ disScaleQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("dis_id", addDisScaleInfoVO.getDisId());
|
|
|
//如果添加过将原来的标签删除
|
|
|
if (this.count(disScaleQueryWrapper) != 0) {
|
|
|
UpdateWrapper<DisScale> updateWrapper = new UpdateWrapper();
|
|
@@ -96,18 +97,18 @@ public class DisScaleFacade extends DisScaleServiceImpl{
|
|
|
* @param getDisScaleAllInfoVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public IPage<GetDisScaleAllInfoDTO> getDisScaleAllInfo(GetDisScaleAllInfoVO getDisScaleAllInfoVO){
|
|
|
+ public IPage<GetDisScaleAllInfoDTO> getDisScaleAllInfo(GetDisScaleAllInfoVO getDisScaleAllInfoVO) {
|
|
|
IPage<GetDisScaleAllInfoDTO> data = this.getDisScaleInfo(getDisScaleAllInfoVO);
|
|
|
List<String> userIds = new ArrayList<>();
|
|
|
- for (GetDisScaleAllInfoDTO getDisScaleAllInfoDTO: data.getRecords()) {
|
|
|
+ for (GetDisScaleAllInfoDTO getDisScaleAllInfoDTO : data.getRecords()) {
|
|
|
userIds.add(getDisScaleAllInfoDTO.getModifier());
|
|
|
}
|
|
|
RespDTO<Map<String, String>> userMap = userServiceClient.getUserInfoByIds(userIds);
|
|
|
- if (userMap == null || !CommonErrorCode.OK.getCode().equals(userMap.code)) {
|
|
|
+ if (RespDTOUtil.respIsNG(userMap)) {
|
|
|
throw new CommonException(CommonErrorCode.RPC_ERROR,
|
|
|
"获取用户信息失败");
|
|
|
}
|
|
|
- for (GetDisScaleAllInfoDTO getDisScaleAllInfoDTO: data.getRecords()) {
|
|
|
+ for (GetDisScaleAllInfoDTO getDisScaleAllInfoDTO : data.getRecords()) {
|
|
|
getDisScaleAllInfoDTO.setUserName(userMap.data.get(getDisScaleAllInfoDTO.getModifier()));
|
|
|
}
|
|
|
return data;
|
|
@@ -119,26 +120,27 @@ public class DisScaleFacade extends DisScaleServiceImpl{
|
|
|
* @param getDisScaleByDisIdVO
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<GetDisScaleAllInfoDTO> getDisScaleByDisId(GetDisScaleByDisIdVO getDisScaleByDisIdVO){
|
|
|
+ public List<GetDisScaleAllInfoDTO> getDisScaleByDisId(GetDisScaleByDisIdVO getDisScaleByDisIdVO) {
|
|
|
//查询诊断量表关联信息
|
|
|
QueryWrapper<DisScale> disScaleQueryWrapper = new QueryWrapper<>();
|
|
|
- disScaleQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
|
|
|
- .eq("dis_id",getDisScaleByDisIdVO.getDisId());
|
|
|
+ disScaleQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .eq("dis_id", getDisScaleByDisIdVO.getDisId());
|
|
|
List<DisScale> disScales = this.list(disScaleQueryWrapper);
|
|
|
List<Long> questionIds = new ArrayList<>();
|
|
|
- List<GetDisScaleAllInfoDTO> getDisScaleAllInfoDTOS = BeanUtil.listCopyTo(disScales,GetDisScaleAllInfoDTO.class);
|
|
|
+ List<GetDisScaleAllInfoDTO> getDisScaleAllInfoDTOS = BeanUtil.listCopyTo(disScales, GetDisScaleAllInfoDTO.class);
|
|
|
for (DisScale disScale : disScales) {
|
|
|
questionIds.add(disScale.getDisId());
|
|
|
questionIds.add(disScale.getScaleId());
|
|
|
}
|
|
|
//查询相关标签名称
|
|
|
QueryWrapper<QuestionInfo> questionInfoQueryWrapper = new QueryWrapper<>();
|
|
|
- questionInfoQueryWrapper.eq("is_deleted",IsDeleteEnum.N.getKey())
|
|
|
- .in("id",questionIds);
|
|
|
+ questionInfoQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
+ .in("id", questionIds);
|
|
|
List<QuestionInfo> questionInfoList = questionFacade.list(questionInfoQueryWrapper);
|
|
|
- Map<Long, QuestionInfo> questionInfoMap = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getId,questionInfo -> questionInfo));
|
|
|
+ Map<Long, QuestionInfo> questionInfoMap
|
|
|
+ = questionInfoList.stream().collect(Collectors.toMap(QuestionInfo::getId, questionInfo -> questionInfo));
|
|
|
//将标签名称放入出参
|
|
|
- for (GetDisScaleAllInfoDTO getDisScaleAllInfoDTO: getDisScaleAllInfoDTOS) {
|
|
|
+ for (GetDisScaleAllInfoDTO getDisScaleAllInfoDTO : getDisScaleAllInfoDTOS) {
|
|
|
getDisScaleAllInfoDTO.setDisName(questionInfoMap.get(getDisScaleAllInfoDTO.getDisId()).getName());
|
|
|
getDisScaleAllInfoDTO.setScaleName(questionInfoMap.get(getDisScaleAllInfoDTO.getScaleId()).getName());
|
|
|
}
|