|
@@ -1,105 +0,0 @@
|
|
-package com.diagbot.facade;
|
|
|
|
-
|
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
-import com.diagbot.entity.LisMapping;
|
|
|
|
-import com.diagbot.enums.IsDeleteEnum;
|
|
|
|
-import com.diagbot.service.impl.LisMappingServiceImpl;
|
|
|
|
-import com.diagbot.util.EntityUtil;
|
|
|
|
-import com.diagbot.util.ListUtil;
|
|
|
|
-import com.diagbot.util.StringUtil;
|
|
|
|
-import com.google.common.collect.Lists;
|
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
|
-
|
|
|
|
-import java.util.LinkedHashMap;
|
|
|
|
-import java.util.List;
|
|
|
|
-import java.util.Map;
|
|
|
|
-
|
|
|
|
-/**
|
|
|
|
- * @Description:
|
|
|
|
- * @Author:zhaops
|
|
|
|
- * @time: 2018/12/27 15:13
|
|
|
|
- */
|
|
|
|
-@Component
|
|
|
|
-public class LisMappingFacade extends LisMappingServiceImpl {
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 获取化验公表映射关系 Map<mealName,Map<itemName,uniqueName>> itemName 不为空
|
|
|
|
- * @param mealNameList
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public Map<String, Map<String, String>> getLisMappingByMealName(List<String> mealNameList) {
|
|
|
|
- Map<String, Map<String, String>> retMap = new LinkedHashMap<>();
|
|
|
|
- QueryWrapper<LisMapping> lisMappingQueryWrapper = new QueryWrapper<>();
|
|
|
|
- lisMappingQueryWrapper.select("meal_name,ifnull(item_name,'') as item_name,unique_name").eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
- if (ListUtil.isNotEmpty(mealNameList)) {
|
|
|
|
- lisMappingQueryWrapper.in("meal_name", mealNameList);
|
|
|
|
- }
|
|
|
|
- List<LisMapping> lisMappingList = this.list(lisMappingQueryWrapper);
|
|
|
|
- Map<String, List<LisMapping>> lisMappingMap = EntityUtil.makeEntityListMap(lisMappingList, "mealName");
|
|
|
|
- for (Map.Entry<String, List<LisMapping>> entry : lisMappingMap.entrySet()) {
|
|
|
|
- if (entry.getValue().size() > 0) {
|
|
|
|
- retMap.put(entry.getKey(), EntityUtil.makeMapWithKeyValue(entry.getValue(), "itemName", "uniqueName"));
|
|
|
|
- } else {
|
|
|
|
- retMap.put(entry.getKey(), null);
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- return retMap;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 化验公表映射关系 Map<uniqueName,List<mealName>>
|
|
|
|
- * @param uniqueNameList
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public Map<String, List<String>> getLisMappingByUniqueName(List<String> uniqueNameList) {
|
|
|
|
- Map<String, List<String>> retMap = new LinkedHashMap<>();
|
|
|
|
- QueryWrapper<LisMapping> lisMappingQueryWrapper = new QueryWrapper<>();
|
|
|
|
- lisMappingQueryWrapper.eq("is_deleted", IsDeleteEnum.N.getKey());
|
|
|
|
- if (ListUtil.isNotEmpty(uniqueNameList)) {
|
|
|
|
- lisMappingQueryWrapper.in("unique_name", uniqueNameList);
|
|
|
|
- }
|
|
|
|
- List<LisMapping> lisMappingList = this.list(lisMappingQueryWrapper);
|
|
|
|
- Map<String, List<LisMapping>> lisMappingMap = EntityUtil.makeEntityListMap(lisMappingList, "uniqueName");
|
|
|
|
- for (Map.Entry<String, List<LisMapping>> entry : lisMappingMap.entrySet()) {
|
|
|
|
- retMap.put(entry.getKey(), EntityUtil.makeListByFieldName(entry.getValue(), "mealName"));
|
|
|
|
- }
|
|
|
|
- return retMap;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * @param project 化验大项
|
|
|
|
- * @param details 化验小项
|
|
|
|
- * @return
|
|
|
|
- */
|
|
|
|
- public Map<String, Map<String, String>> getLisMappingByQuestion(String project, List<String> details) {
|
|
|
|
- if (StringUtil.isBlank(project)) {
|
|
|
|
- return null;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- List<String> mealNameList = Lists.newLinkedList();
|
|
|
|
- mealNameList.add(project);
|
|
|
|
- Map<String, Map<String, String>> lisMappingMap = getLisMappingByMealName(mealNameList);
|
|
|
|
-
|
|
|
|
- Map<String, Map<String, String>> retMap = new LinkedHashMap<>();
|
|
|
|
- if (lisMappingMap != null && lisMappingMap.get(project) != null) {
|
|
|
|
- Map<String, String> projectMap = new LinkedHashMap<>();
|
|
|
|
- projectMap.put(project, lisMappingMap.get(project).get(""));
|
|
|
|
- retMap.put("project", projectMap);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (ListUtil.isEmpty(details)) {
|
|
|
|
- return retMap;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- Map<String, String> detailMap = new LinkedHashMap<>();
|
|
|
|
- Map<String, String> projectDetailMap = lisMappingMap.get(project);
|
|
|
|
- if (projectDetailMap != null) {
|
|
|
|
- for (String detail : details) {
|
|
|
|
- detailMap.put(detail, projectDetailMap.get(detail));
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- retMap.put("details", detailMap);
|
|
|
|
- return retMap;
|
|
|
|
- }
|
|
|
|
-}
|
|
|