|
@@ -0,0 +1,85 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.diagbot.entity.LisMapping;
|
|
|
+import com.diagbot.entity.wrapper.LisMappingWrapper;
|
|
|
+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.diagbot.vo.GetLisMappingVO;
|
|
|
+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: 2019/9/20 13:14
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class LisMappingFacade extends LisMappingServiceImpl {
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取化验公表映射关系 Map<mealName,Map<itemName,uniqueName>> itemName 不为空
|
|
|
+ * @param mealName
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String, Map<String, String>> getLisMappingByMealName(String mealName) {
|
|
|
+ Map<String, Map<String, String>> retMap = new LinkedHashMap<>();
|
|
|
+ LisMappingWrapper lisMappingWrapper = new LisMappingWrapper();
|
|
|
+ lisMappingWrapper.setMealName(mealName);
|
|
|
+ List<LisMappingWrapper> lisMappingWrapperList = this.getLisMappingByName(lisMappingWrapper);
|
|
|
+
|
|
|
+ Map<String, List<LisMappingWrapper>> lisMappingMap = EntityUtil.makeEntityListMap(lisMappingWrapperList, "mealName");
|
|
|
+ for (Map.Entry<String, List<LisMappingWrapper>> 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;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取化验标签公表项
|
|
|
+ * @param getLisMappingVO
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String, Map<String, String>> getLisMappingByQuestion(GetLisMappingVO getLisMappingVO) {
|
|
|
+ String project=getLisMappingVO.getProject();
|
|
|
+ List<String> details=getLisMappingVO.getDetails();
|
|
|
+ if (StringUtil.isBlank(project)) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<String, Map<String, String>> lisMappingMap = getLisMappingByMealName(project);
|
|
|
+
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+}
|