|
@@ -27,6 +27,7 @@ import com.diagbot.vo.IdVO;
|
|
|
import com.diagbot.vo.LisConfigListVO;
|
|
|
import com.diagbot.vo.LisConfigPageVO;
|
|
|
import com.google.common.collect.Lists;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
@@ -483,4 +484,66 @@ public class LisConfigFacade{
|
|
|
String fileName = "检验映射模板.xls";
|
|
|
ExcelUtils.exportExcel(new ArrayList<>(), null, "sheet1", LisConfig.class, fileName, response, 12.8f);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导入数据预匹配
|
|
|
+ * @param file
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ public void precDataMatch(MultipartFile file,HttpServletResponse response) {
|
|
|
+ List<LisConfig> retList = Lists.newLinkedList();
|
|
|
+ List<LisConfig> originList = ExcelUtils.importExcel(file, 0, 1, LisConfig.class);
|
|
|
+
|
|
|
+ Map<String,Map<String, List<LisConfig>>> allMap = getAll();
|
|
|
+ if (ListUtil.isNotEmpty(originList)) {
|
|
|
+ for (LisConfig originItem : originList) {
|
|
|
+ if (StringUtils.isBlank(originItem.getHisDetailName())) {
|
|
|
+ originItem.setHisDetailName("");
|
|
|
+ }
|
|
|
+ if (allMap.containsKey(originItem.getHisName())
|
|
|
+ && allMap.get(originItem.getHisName()).containsKey(originItem.getHisDetailName())) {
|
|
|
+ retList.addAll(allMap.get(originItem.getHisName()).get(originItem.getHisDetailName()));
|
|
|
+ } else {
|
|
|
+ retList.add(originItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String fileName = "检验关联数据(预匹配).xls";
|
|
|
+ ExcelUtils.exportExcel(retList, null, "sheet1", LisConfig.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取所有医院映射数据
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String,Map<String,List<LisConfig>>> getAll() {
|
|
|
+ Map<String, Map<String, List<LisConfig>>> retMap = new HashMap<>();
|
|
|
+ List<LisConfig> records = lisConfigService.list();
|
|
|
+ if (ListUtil.isEmpty(records)) {
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ records.forEach(record -> {
|
|
|
+ record.setHospitalId(null);
|
|
|
+ record.setId(null);
|
|
|
+ record.setHisDetailName(StringUtils.isBlank(record.getHisDetailName()) ? "" : record.getHisDetailName());
|
|
|
+ record.setUniqueCode(StringUtils.isBlank(record.getUniqueCode()) ? "" : record.getUniqueCode());
|
|
|
+ });
|
|
|
+
|
|
|
+ records = records
|
|
|
+ .stream()
|
|
|
+ .filter(record -> record.getIsDeleted().equals(IsDeleteEnum.N.getKey()))
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+
|
|
|
+ if (ListUtil.isEmpty(records)) {
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ Map<String, List<LisConfig>> hisNameMap = EntityUtil.makeEntityListMap(records, "hisName");
|
|
|
+
|
|
|
+ for (Map.Entry<String, List<LisConfig>> entry : hisNameMap.entrySet()) {
|
|
|
+ retMap.put(entry.getKey(),
|
|
|
+ EntityUtil.makeEntityListMap(entry.getValue(), "hisDetailName"));
|
|
|
+ }
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
}
|