|
@@ -28,6 +28,7 @@ import com.diagbot.vo.HospitalIdVO;
|
|
|
import com.diagbot.vo.IdListVO;
|
|
|
import com.diagbot.vo.IdVO;
|
|
|
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;
|
|
@@ -307,7 +308,7 @@ public class DrugConfigFacade {
|
|
|
for (int i = 0; i < drugConfigList.size(); i++) {
|
|
|
if (StringUtil.isBlank(drugConfigList.get(i).getHisName())
|
|
|
|| StringUtil.isBlank(drugConfigList.get(i).getUniqueName())) {
|
|
|
- emptyNumList.add(String.valueOf(i + 2));
|
|
|
+ emptyNumList.add(String.valueOf(i + 3));
|
|
|
}
|
|
|
if (StringUtil.isNotBlank(drugConfigList.get(i).getHisName())) {
|
|
|
drugConfigList.get(i).setHisName(drugConfigList.get(i).getHisName().trim());
|
|
@@ -317,7 +318,7 @@ public class DrugConfigFacade {
|
|
|
}
|
|
|
if (StringUtil.isNotBlank(drugConfigList.get(i).getForm())) {
|
|
|
if (!formList.contains(drugConfigList.get(i).getForm())) {
|
|
|
- formErrNumList.add(String.valueOf(i + 2));
|
|
|
+ formErrNumList.add(String.valueOf(i + 3));
|
|
|
} else {
|
|
|
drugConfigList.get(i).setForm(drugConfigList.get(i).getForm().trim());
|
|
|
}
|
|
@@ -634,4 +635,59 @@ public class DrugConfigFacade {
|
|
|
from += "]";
|
|
|
return from;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导入数据预匹配
|
|
|
+ * @param file
|
|
|
+ * @param response
|
|
|
+ */
|
|
|
+ public void precDataMatch(MultipartFile file,HttpServletResponse response) {
|
|
|
+ List<DrugConfig> retList = Lists.newLinkedList();
|
|
|
+ List<DrugConfig> originList = ExcelUtils.importExcel(file, 1, 1, DrugConfig.class);
|
|
|
+
|
|
|
+ Map<String, List<DrugConfig>> allMap = getAll();
|
|
|
+ if (ListUtil.isNotEmpty(originList)) {
|
|
|
+ for (DrugConfig originItem : originList) {
|
|
|
+ if (allMap.containsKey(originItem.getHisName())) {
|
|
|
+ retList.addAll(allMap.get(originItem.getHisName()));
|
|
|
+ } else {
|
|
|
+ retList.add(originItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ String fileName = "药品关联数据(预匹配).xls";
|
|
|
+ ExcelUtils.exportExcel(retList, null, "sheet1", DrugConfig.class, fileName, response, 12.8f);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取所有医院映射数据
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String,List<DrugConfig>> getAll() {
|
|
|
+ Map<String, List<DrugConfig>> retMap = new HashMap<>();
|
|
|
+ List<DrugConfig> records = drugConfigService.list();
|
|
|
+ if (ListUtil.isEmpty(records)) {
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+ records.forEach(record -> {
|
|
|
+ record.setHospitalId(null);
|
|
|
+ record.setId(null);
|
|
|
+ record.setUniqueCode(StringUtils.isBlank(record.getUniqueCode()) ? "" : record.getUniqueCode());
|
|
|
+ record.setForm(StringUtils.isBlank(record.getForm()) ? null : record.getForm());
|
|
|
+ });
|
|
|
+
|
|
|
+ records = records
|
|
|
+ .stream()
|
|
|
+ .filter(record -> record.getIsDeleted().equals(IsDeleteEnum.N.getKey()))
|
|
|
+ .distinct()
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ if (ListUtil.isEmpty(records)) {
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ retMap = EntityUtil.makeEntityListMap(records, "hisName");
|
|
|
+
|
|
|
+ return retMap;
|
|
|
+ }
|
|
|
}
|