|
@@ -2,20 +2,16 @@ package com.diagbot.facade;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
import com.diagbot.dto.ExportDiagnoseDTO;
|
|
import com.diagbot.dto.ExportDiagnoseDTO;
|
|
-import com.diagbot.dto.ExportDiagnoseNameDTO;
|
|
|
|
import com.diagbot.entity.KlDiagnoseDetail;
|
|
import com.diagbot.entity.KlDiagnoseDetail;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.enums.IsDeleteEnum;
|
|
import com.diagbot.service.impl.KlDiagnoseDetailServiceImpl;
|
|
import com.diagbot.service.impl.KlDiagnoseDetailServiceImpl;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.BeanUtil;
|
|
import com.diagbot.util.EntityUtil;
|
|
import com.diagbot.util.EntityUtil;
|
|
-import com.diagbot.util.ExcelUtils;
|
|
|
|
import org.apache.commons.compress.utils.Lists;
|
|
import org.apache.commons.compress.utils.Lists;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
-import javax.servlet.http.HttpServletResponse;
|
|
|
|
import java.util.LinkedHashMap;
|
|
import java.util.LinkedHashMap;
|
|
-import java.util.LinkedList;
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -70,10 +66,19 @@ public class KlDiagnoseDetailFacade extends KlDiagnoseDetailServiceImpl {
|
|
for(Map.Entry<String, List<KlDiagnoseDetail>> kd : diagnoseDetailMap.entrySet()){
|
|
for(Map.Entry<String, List<KlDiagnoseDetail>> kd : diagnoseDetailMap.entrySet()){
|
|
String sheetName = kd.getKey();
|
|
String sheetName = kd.getKey();
|
|
List<KlDiagnoseDetail> datats = kd.getValue();
|
|
List<KlDiagnoseDetail> datats = kd.getValue();
|
|
|
|
+ removeKlDiagnoseDetail(datats);
|
|
List<ExportDiagnoseDTO> eds = Lists.newArrayList();
|
|
List<ExportDiagnoseDTO> eds = Lists.newArrayList();
|
|
for (KlDiagnoseDetail kdl:datats) {
|
|
for (KlDiagnoseDetail kdl:datats) {
|
|
ExportDiagnoseDTO exportDiagnoseDTO = new ExportDiagnoseDTO();
|
|
ExportDiagnoseDTO exportDiagnoseDTO = new ExportDiagnoseDTO();
|
|
BeanUtil.copyProperties(kdl, exportDiagnoseDTO);
|
|
BeanUtil.copyProperties(kdl, exportDiagnoseDTO);
|
|
|
|
+ ReflectUtil.setProperty(exportDiagnoseDTO, "type", kdl.getType().toString());
|
|
|
|
+ ReflectUtil.setProperty(exportDiagnoseDTO, "orderNo", kdl.getCode());
|
|
|
|
+ if(kdl.getCode().startsWith("3.")){
|
|
|
|
+ exportDiagnoseDTO.setRule(kdl.getRelation());
|
|
|
|
+ }else {
|
|
|
|
+ exportDiagnoseDTO.setRule(kdl.getStandard());
|
|
|
|
+ }
|
|
|
|
+ exportDiagnoseDTO.setEq(kdl.getMidResult());
|
|
exportDiagnoseDTO.setType("1223");
|
|
exportDiagnoseDTO.setType("1223");
|
|
eds.add(exportDiagnoseDTO);
|
|
eds.add(exportDiagnoseDTO);
|
|
}
|
|
}
|
|
@@ -98,4 +103,65 @@ public class KlDiagnoseDetailFacade extends KlDiagnoseDetailServiceImpl {
|
|
return exportDiagnoseNameDTOList;
|
|
return exportDiagnoseNameDTOList;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 移除公式编码中没有的数据
|
|
|
|
+ * @param klDiagnoseDetails
|
|
|
|
+ */
|
|
|
|
+ public void removeKlDiagnoseDetail(List<KlDiagnoseDetail> klDiagnoseDetails){
|
|
|
|
+ Map<String, List<String>> allFormula = getAllFormula(klDiagnoseDetails);
|
|
|
|
+ List<String> regexData = getCodes(allFormula);
|
|
|
|
+ Iterator<KlDiagnoseDetail> iterator = klDiagnoseDetails.iterator();
|
|
|
|
+ while (iterator.hasNext()){
|
|
|
|
+ KlDiagnoseDetail next = iterator.next();
|
|
|
|
+ String code = next.getCode();
|
|
|
|
+ if(!regexData.contains(code) && StringUtil.isNotBlank(code)){
|
|
|
|
+ iterator.remove();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取每个诊断依据的公式
|
|
|
|
+ * @param klDiagnoseDetails
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private Map<String,List<String>> getAllFormula(List<KlDiagnoseDetail> klDiagnoseDetails){
|
|
|
|
+ Map<String,List<String>> typeFormulaMap = new HashMap<>();
|
|
|
|
+ for (KlDiagnoseDetail klDiagnoseDetail : klDiagnoseDetails) {
|
|
|
|
+ Integer type = klDiagnoseDetail.getType();
|
|
|
|
+ String formula = klDiagnoseDetail.getFormula();
|
|
|
|
+ if((type == 91 || type == 92 || type == 93)&& StringUtil.isNotBlank(formula)){
|
|
|
|
+ if(typeFormulaMap.containsKey(type.toString())){
|
|
|
|
+ List<String> formulas = typeFormulaMap.get(type.toString());
|
|
|
|
+ formulas.add(formula);
|
|
|
|
+ typeFormulaMap.put(type.toString(),formulas);
|
|
|
|
+ }else {
|
|
|
|
+ List<String> formulas = Lists.newArrayList();
|
|
|
|
+ formulas.add(formula);
|
|
|
|
+ typeFormulaMap.put(type.toString(),formulas);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return typeFormulaMap;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 获取公式中的所有编码
|
|
|
|
+ * @param getAllFormula
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private List<String> getCodes(Map<String,List<String>> getAllFormula) {
|
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
|
+ String pateern = "([1-9]\\d*\\.?\\d*)|(0\\.\\d*[1-9])";
|
|
|
|
+ if(MapUtils.isNotEmpty(getAllFormula)){
|
|
|
|
+ getAllFormula.forEach((x,y) ->{
|
|
|
|
+ String collect = y.stream().collect(Collectors.joining(","));
|
|
|
|
+ sb.append(collect).append("+");
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ //获取公式中的编码
|
|
|
|
+ return RegexUtil.getRegexDatas(sb.toString(), pateern);
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|